[AccessD] Do While Syntax

John Bartow john at winhaven.net
Wed Sep 30 01:44:15 CDT 2009


What is the syntax to set a variable to a field's value in the current row
of a recordset?

----------------------------------------------------------------------------
--
Private Sub PrintAllReports()
    'Loops through AddressData table and prints all customer reports
    
    Dim db As Database
    Dim rs As Recordset
    Set db = CurrentDb
    Dim lngAcctNum As Long
    
    lngSum = 0
    
    Set rs = db.OpenRecordset("SELECT * FROM AddressData ORDER BY
TrayNumber")
    Do While Not rs.EOF
        'set variable to lngAcctNum current AccountNumber field to use as
filter in each report
        lngAcctNum =
        'Print Report 1 using: AccountNumber = lngAcctNum as report filter
        'Print Report 2 using: AccountNumber = lngAcctNum as report filter
        'Print Report 3 using: AccountNumber = lngAcctNum as report filter
        rs.MoveNext
    Loop
    rs.Close

End Sub
----------------------------------------------------------------------------
--





More information about the AccessD mailing list