Unanswered: automate reports from a parameter query
I have more than 100 customer statements I need to print out every few days. These reports are based on a query which need the customer number input (Parameter). I have tried to extract this list of customers into a table and use the recordset loop example I found in this forum but haven't been able to make it work.
I am using Access XP and am printing the reports to Acrobat Distiller. Can one of you please guide me to getting this automated and attaching the customer number to the acrobat file saved? I am a newbie when it comes to Access VB and recordsets. Thanks in advance for your help.
I somehow got to this stage and have most of it working. I hope you cen see what I am trying to do here in the code.
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim qdf As DAO.QueryDef
Dim prm As DAO.Parameter
Set db = CurrentDb()
Set rst = db.OpenRecordset("tbl_cust_bal_for_stmts")
Set qdf = db.QueryDefs("qry_cust_parameter")
Set prm = qdf.Parameters("Enter Company ID")
Do While Not rst.EOF
prm = rst.Fields("cust_id")
Set prm = Nothing
I am getting a dbFailOnError = 128 when executing this. Can someone help me resolve this?
I am such a dumbo. I was looking in the wrong place for the error message. My parameter qry is a make-table query and hence the execute method failed as the table existed already. I just had to delete the table for every repitition. Thanks so much GodMadeIncubus for asking the right questions. You've been a great help.