Access开发培训
网站公告
·Access专家课堂QQ群号:151711184    ·Access快速开发平台下载地址及教程    ·欢迎加入Access专家课堂微信群!    ·如何快速搜索本站文章|示例|资料    
您的位置: 首页 > 技术文章 > 销售应用

模糊查询,子窗体查询,预览查询结果报表

时 间:2009-04-24 12:29:56
作 者:何侠   ID:4602  城市:商丘
摘 要:初学者,正在建进销存系统,希望多多交流!
正 文:

支持文件:

表《销售表》

查询〈销售查询〉

窗体〈销售查询窗体〉

报表〈销售报表〉

步骤:

〈销售表〉生成〈销售查询〉,查询条件:like [forms]![销售查询窗体]![材质] & "*"

《销售查询》生成《销售查询窗体》数据源删掉,子窗体控件做出销售子窗体查询

注:《销售查询窗体》易犯错误:1.组合框,文本框--属性(事件)--更新后--事件过程---me.refresh

                                                             2.属性(数据)---数据源如果是两列--绑定列:2//格式--列数:2

代码如下:

Private Sub Command17_Click()
        Dim strsql As String
        strsql = "select * from 销售表 where 1=1"
        If IsNull(Me.材质) = False Then
             Me.材质.SetFocus
            strsql = strsql & " and 材质 like '*" & Me.材质.Text & "*'"
        End If
        If IsNull(Me.规格) = False Then
           Me.规格.SetFocus
           strsql = strsql & " and 规格 like '*" & Me.规格.Text & "*'"
        End If
          If IsNull(Me.色号) = False Then
           Me.色号.SetFocus
           strsql = strsql & " and 色号 like '*" & Me.色号.Text & "*'"
           End If
          If IsNull(Me.销售日期) = False Then
           Me.销售日期.SetFocus
           strsql = strsql & " and 销售日期 like '*" & Me.销售日期.Text & "*'"
            End If
          If IsNull(Me.月份) = False Then
           Me.月份.SetFocus
           strsql = strsql & " and 月份 like '*" & Me.月份.Text & "*'"
            End If
          If IsNull(Me.客户编号) = False Then
           Me.客户编号.SetFocus
           strsql = strsql & " and 客户编号 like '*" & Me.客户编号.Text & "*'"
        End If
        Me.销售表子窗体.Form.RecordSource = strsql
        Me.销售表子窗体.Form.Refresh
Me.Refresh
End Sub

Private Sub Command18_Click()
Me.材质 = Null
Me.规格 = Null
Me.色号 = Null
Me.销售日期 = Null
Me.月份 = Null
Me.客户编号 = Null
Me.销售表子窗体.Form.RecordSource = "select * from 销售表 where 1=1"
End Sub

Private Sub 材质_AfterUpdate()
Me.Refresh
End Sub

Private Sub 规格_AfterUpdate()
Me.Refresh
End Sub

Private Sub 客户编号_AfterUpdate()
Me.Refresh
End Sub

Private Sub 色号_AfterUpdate()
Me.Refresh
End Sub

Private Sub 销售日期_AfterUpdate()
Me.Refresh
End Sub

Private Sub 月份_AfterUpdate()
Me.Refresh
End Sub

按自己理解意思,写的不太详细,如有不明白请提问!



Access软件网QQ交流群 (群号:483923997)       Access源码网店

常见问答:

技术分类:

相关资源:

专栏作家

关于我们 | 服务条款 | 在线投稿 | 友情链接 | 网站统计 | 网站帮助