office交流網--QQ交流群號

Access培訓群:792054000         Excel免費交流群群:686050929          Outlook交流群:221378704    

Word交流群:218156588             PPT交流群:324131555

access篩選窗體記録

2020-07-05 08:00:00
tmtony8
原創
600

在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 = "[金額]<=" & txt2
    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


    分享