View Full Version : Run report based on current record?


pokerace
10-13-2008, 08:29 AM
I have a report named CaseNotes. I have inserted a command button on a form linking to the report, and I would like the report to be run for only the current record, by using the Client.Client ID field. How can I accomplish this?

I have tried the following code in both the OnClick and OnEnter, but the report still produces the results for all records.

DoCmd.OpenReport "CaseNotes", acViewPreview, , _
"[Client ID]=Forms!CaseNotes !Client ID"

pokerace
10-13-2008, 09:40 AM
Got it. Had the wrong form name in the code.

DoCmd.OpenReport stDocName, acPreview, , "[Client ID]= forms![Form Client Information]![Client ID]"