Parameter Passing to print single record

mba1942

Registered User.
Local time
Today, 11:19
Joined
Apr 5, 2012
Messages
16
Access 2007:
I have a form which our clients can to sign in when they come to visit... It contains basic information which is captured and printed on a worksheet for our service representatives to use to assist the client.

Table Name: Visits (current number of records: 10,000+)
Key Field: VisitID (Auto number field)

I have created a report: "rptDayByDayVisits" which is called within the form (frmSignIn-wPrint) upon pressing the save & print button after the form field data is entered.

Question: How do I capture the "VisitID" field data - which has been auto filled on the form - and send it as a parameter to the DoCmd.OpenReport?

The intent is to print only a single record ID'd by the "VisitID" field...

Currently I have coded:

X = 10327 ' This works but is a constant

strWhere = "[VisitID] = " & X
DoCmd.OpenReport "rptDayByDayVisits", acViewPreview, , strWhere

I'm not sure if this is the correct path to take... Again, how can I dynamicaly capture the "VisitID" value from the form and insert it as a paramater into the DoCmd.OpenReport function?
 

Users who are viewing this thread

Back
Top Bottom