在access程序中,我们对数据进行查询筛选。
如图,在连续窗体中,我们通过一个金额数值范围来筛选数据。
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strje As String
Dim strje1 As String
Dim strje2 As String
Set db = CurrentDb()
Set rs = db.OpenRecordset("销售记录", dbOpenDynaset)
'设置筛选参数
strje1 = "[金额]>=" & txt1
strje2 = "[金额]
strje = strje1 & " and " & strje2
'执行筛选操作
rs.Filter = strje
Set rs = rs.OpenRecordset
Set Me.Recordset = rs
Me.Requery
End If
Set rs = Nothing
Set db = Nothing
领取专属 10元无门槛券
私享最新 技术干货