Form - Report synchronizing (1 Viewer)

C

Chris Holmes

Guest
I have a form that is indexed by date. I have a button that links the form to the corresponding report. I would like the button to open up the report for the currently viewed record(date) of the form instead of defaulting to the first record.
Thanks for your help
 
P

Phillip

Guest
Assuming the form and the report are both assigned to the same table or query, include a "where" clause on the line that opens the report (from the OnClick event of the button on your form). Something like:
DoCmd.OpenReport "TheReport",,"[RecordID] = Form.[RecordID]"
I'm not positive about the number of commas, but I'm pretty sure it's an available parameter.
You could also try creating a query that pulls the necessary fields from the table you're using. Then add criteria under the record identifying field, (for example, [Forms]![MyForm]![RecordID]), change the record source of the report to your new query and you're set.
I hope that was helpful.
 

Users who are viewing this thread

Top Bottom