Access 2003 set report focus from form

sadist

Registered User.
Local time
Today, 07:55
Joined
Mar 2, 2010
Messages
11
Hi, I would appreciate a little guidance on the following:

I have a form with a number of fields including ID and Report_number.
I have 4 Reports named 1,2,3 and 4, each report uses some or all the form fields and the forms Report_number specifies which report to print that record on.
I have set the On Dbl Click property on the ID field to open a report for the record in focus but I could do with some help on opening the correct report as specified in the Report_number field.
So far I have

DoCmd.OpenReport "1", acViewPreview, , "[ID] = " & Me!ID

Many thanks
 
I could do with some help on opening the correct report as specified in the Report_number field.
So far I have

DoCmd.OpenReport "1", acViewPreview, , "[ID] = " & Me!ID

Seems to me the code does not match your text.

Do you need to pass into report named "1" a value for ID, or do you really mean to open a report which is the same name as the value of Form field ID?

If truly the latter, then perhaps this will work:

Code:
DoCmd.OpenReport Me.ID.Value, acViewPreview
 
Try

DoCmd.OpenReport Me.ReportNumber, acViewPreview, , "[ID] = " & Me!ID

using the actual name of the control containing the report number.
 
Many thanks Michael and Paul for your help
'Me.Report_number.Value' worked

Regards
Dermot
 
You are most welcome, Dermot. Thank you for following up with success to this question.
 

Users who are viewing this thread

Back
Top Bottom