0

I have a table that feeds several reports. For each customer, for example, I have a different report with his own logo, etc, but all these reports gets their data from one table. Each report has a different name which is attached to the customer name in a different column. I have then a form where I select the customer and the respective report name comes up in a textbox. I want to open each individual report with a command button using the following command: DoCmd.OpenReport " REPORT_NAME ", acViewPreview

"REPORT_NAME" has to be replaced with the string value from the textbox for each individual customer from the opening form.

What command should I use to solve this?

I hope this is not too confusing.

Thanks in advance.

1 Answer 1

1

Not sure if I'm missing something, but you can simply do

DoCmd.OpenReport Me!theTextboxWithReportName, acViewPreview

or a little more elaborate

Dim strReport As String
strReport = Nz(Me!theTextboxWithReportName, "")
If strReport <> "" Then
    DoCmd.OpenReport strReport, acViewPreview
End If
Sign up to request clarification or add additional context in comments.

1 Comment

Dear Andre, Thank you very much for your reply. The first simple line solves my problem very elegant, I wasn't sure how to use the "Me" command. I kept using Me.textbox instead of Me!textbox. Problem solved. Thank you very much.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.