Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with exact grammar for openreport method 1

Status
Not open for further replies.

smithph

Technical User
Oct 27, 2000
57
0
0
GB
Hi, all, Hope you are all having a great day.
I am stuck with the right way of telling the openreport method the name of the report and the view of the report using variables.
What I want to do is write this
DoCmd.OpenReport reportneeded reportmode

reportneeded is a string that has the right information in it from previous coding.
reportmode is a string that has the right information in it from previous coding.

How on earth can I put these together to make the expression work?

And why didn't Microsoft see the need for this requirement when they made up the help files? The help files are useless.
 
Don't know where your "previous" coding comes from, but you can pass variables to the print command:

I have a form where the user selects a form for viewing from a dropdown box. That command is passed to print command.


Dim strDocName As String, strDocView as String

strDocName = [Forms]![frmReportMenu]![rptName]
strDocView = [Forms]![frmReportMenu]![rptView]

DoCmd.OpenReport strDocName, strDocView

Hope this helps.

Jim "Get it right the first time, that's the main thing..." [wavey]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top