Hi all,

I am getting problem in passing variables to a query
I've created a loop to run through all the clients in a table to generate their invoices.

How can I pass the client's ID to the query which is used in generating the report? Both reports call the same query. The query currently works fine when prompting for the ID to be entered manually.

currently have:

Code:
Private Sub Command9_Click()

Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim fd As DAO.Field

Set db = CurrentDb()
Set rs = db.OpenRecordset("t_Clients")


rs.MoveFirst
Do While Not rs.EOF
' add something about the Clients ID <-----
If rs!credit_card Then
Generate_Invoice ("R_invoice_generate")
Else
Generate_Invoice ("R_inv_gen_wid_Ccard")
End If
rs.MoveNext
Loop

End Sub