Stuart McLachlan
stuart at lexacorp.com.pg
Wed Sep 30 02:01:15 CDT 2009
lngAcctNum = rs!AcctNum
DoCmd.OpenReport "Report1",acViewPreview,,"AccountNum = " & lngAcctNum
or simply
DoCmd.OpenReport "Report1",acViewPreview,,"AccountNum = " & rs!AcctNum
--
Stuart
On 30 Sep 2009 at 1:44, John Bartow wrote:
> 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
> ----------------------------------------------------------------------------
> --
>
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com