在access程序中靶壮,我們對數(shù)據(jù)進(jìn)行查詢篩選纳鼎。
如圖傀顾,在連續(xù)窗體中,我們通過一個(gè)金額數(shù)值范圍來篩選數(shù)據(jù)薄货。
? ? 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)
'設(shè)置篩選參數(shù)
? ? strje1?= "[金額]>=" & txt1
? ? strje2?= "[金額]<=" & txt2
? ? strje?= strje1?& " and " & strje2?
'執(zhí)行篩選操作
? ? rs.Filter = strje?
? ? Set rs = rs.OpenRecordset
? ? Set Me.Recordset = rs
? ? Me.Requery
? ? End If
? ? Set rs = Nothing
? ? Set db = Nothing