|
也可以这样,
1、模糊查询
'查询语句
Me.Refresh
Dim strWhere As String
strWhere = ""
If IsNull(Me.Text0) Then
MsgBox "请输入要查询的公司的简称!", vbExclamation, "警告!"
End If
If Not IsNull(Me.Text0) Then
strWhere = strWhere & "([F3] like '*" & Me.Text0 & "*') AND "
End If
'==========================================================
If Len(strWhere) > 0 Then
strWhere = Left(strWhere, Len(strWhere) - 5)
End If
Me.all1.Form.FilterOn = True
Me.all1.Form.Filter = strWhere
2、 '下面这些控件的值要清空
Me.Text0 = Null
Me.all1.Form.FilterOn = False
3、 '预览窗体查询结果
If IsNull(Me.Text0) Then
MsgBox "您还没有进行查询!", vbExclamation, "警告"
Else
Me.Refresh
DoCmd.OpenReport "mylike", acPreview, , Me.all1.Form.Filter
End If
4、'打印窗体查询结果
If IsNull(Me.Text0) Then
MsgBox "您还没有进行查询!", vbExclamation, "警告"
Else
MsgBox "请确认打印机的电源已开启及纸张是否足够", vbExclamation, "警告!"
Me.Refresh
DoCmd.OpenReport "mylike", acViewNormal, , Me.all1.Form.Filter
End If |
|