Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need Help With Parameters

Status
Not open for further replies.

gator9

Technical User
May 17, 2002
162
US
Ok I am trying to have a marco output a report for each client to it's on folder where each clients reports are stored. I have it working like a charm with one exception. The report filters data via client ID so it ask me for a parameter value for each output. Can anyone tell me what condition in the micro will auto enter the parameter of the client. Please keep in mind that there is one macro excuting all the clients info so I have to have a filter, but I need to know how to auto enter in the condition for each client there ID number.

Condition | Action | Comments
Client1 ID | Output Data | Nothing
Client2 ID | Output Data | Nothing

Thanks
 
It sounds like a little VBA code is necessary here. You should create a looping process that reads a table of all of the clients and then runs, stores, and moves on to the next clientID. This can only be done with some code behind a button.

You can either use a table of all of the clients or you a dynamic query that will give you a list of the clients in the table that is creating your report.

Take this SQL code and paste it into the SQL screen of a new query and call it qryClientIDs.

SELECT tblReportTable.ClientID FROM tblReportTable
GROUP BY tblReportTable.ClientID
ORDER BY tblReportTable.ClientID;

Create a global variable and function in a module:

Global vClientID as string(or Long depending of type)
Function ClientID()
ClientID = vClientID
End Function

Now paste the following behind a button:

dim db as database
dim rs as recordset
set db = currentdb
set rs = db.openrecordset("qryClientIDs", dbOpenDynaset)
rs.movefirst
Do
vClientID = MyRS("ClientID")

Place your code for your report and saving process here. Use the function ClientID() in your process fill-in for your prompting of the clientID.

rs.movenext
loop until rs.eof
rs.close
db.close

Take a look and if you need more explaination let me know.

Bob Scriver
 
Thank much I will try it.

Charles
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top