模糊查询,子窗体查询,预览查询结果报表
时 间: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交流群 (群号:54525238) Access源码网店
常见问答:
技术分类:
源码示例
- 【源码QQ群号19834647...(12.17)
- 【Access选项卡示例】Ac...(09.09)
- 【Access源码示例】按输入...(09.02)
- 【Access日期区间段查询】...(08.29)
- 【Access日期区间段查询】...(08.27)
- Access怎样才能实现日期时...(08.21)
- 【Access定时打开查询】A...(08.19)
- Access生成固定数量的记录...(08.13)
- Access怎样才能实现日期时...(08.12)
- Access利用导航窗体控件对...(08.03)
学习心得
最新文章
- Access表中的字段名、字段标题...(09.19)
- Access快速开发平台--更改“...(09.18)
- 【中秋及国庆优惠】Access培训...(09.15)
- Access如何将日期型的数值转换...(09.14)
- 英文输入法输入数据中存在单引号引起...(09.11)
- 【Access选项卡示例】Acce...(09.09)
- 让Access光标停留在指定的控件...(09.07)
- 关于Access查询条件里使用通配...(09.06)
- Access报表偷懒制作法--Ac...(09.05)
- Access快速开发平台--窗体数...(09.04)