模糊查询,子窗体查询,预览查询结果报表-何侠
Access软件网QQ交流学习群(群号码198465573),欢迎您的加入!
首页 >技术文章> 销售应用


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

发表时间:2009/4/24 12:29:56 评论(1) 浏览(14278)  评论 | 加入收藏 | 复制
   
摘 要:初学者,正在建进销存系统,希望多多交流!
正 文:

支持文件:

表《销售表》

查询〈销售查询〉

窗体〈销售查询窗体〉

报表〈销售报表〉

步骤:

〈销售表〉生成〈销售查询〉,查询条件: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群(群号:198465573)
 
 相关文章
【Access源码示例】Access组合框下拉列表模糊查询功能的完...  【红尘如烟  2013/3/5】
[Access源码]改进---组合框下拉列表模糊查询功能的完美实现  【漏蛧尐魚℡  2013/3/7】
遍历窗体全字段模糊查询  【一杯绿茶  2013/7/1】
采用函数形式实现遍历子窗体文本框模糊查询文本内容  【cspa  2013/7/16】
常见问答
技术分类
相关资源
文章搜索
关于作者

何侠

文章分类

文章存档

友情链接