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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DoCmd.OpenReport passing arguments

Status
Not open for further replies.

Jackie

MIS
Feb 9, 2000
148
US
I use the following code to print the same report with different data.&nbsp;&nbsp;One report prints for all orgs.&nbsp;&nbsp;The second report prints for only an org specified in a control on a form.&nbsp;&nbsp;When the OK button is selected, this code is executed when the org field is not empty:<br><br>DoCmd.OpenReport &quot;rpt_Statistics_by_Year_Org&quot;, A_PREVIEW, , Org_Code_Short = [Forms]![Statistics Form]![txt_Component]<br><br>The report is executed showing &quot;error&quot;.&nbsp;&nbsp;Data exists in the underlying query to display on the report.&nbsp;&nbsp;&quot;org_code_short&quot; is a field in the underlying query.<br><br>What is causing no data to be displayed?
 
If org_code_short does not appear on the report itself fully qualify the condition:<br><br>reports![rpt_Statistics_by_Year_Org]![org_code_short]=[Forms]![Statistics Form]![txt_Component]<br><br>is the field on the report called org_code_short?<br><br>Let's go from here.<br><br>
 
Yes, org_code_short appears on the report.<br><br>When I fully qualify the condition, I get the following error message: &quot;The report name &quot;rpt_statistics_by_year_org&quot; you entered is misspelled or refers to a specific report that isn't open or doesn't exist&quot;.<br><br><br>I use a &quot;_&quot; as a line continuation,. but took it out and put the entire code on one line and the error message still appears.<br><br>Also, is the &quot; _ &quot; (underline) the correct line continuation indicator?<br><br><br><br>
 
Could you please repost your last response.&nbsp;&nbsp;Only the first 5 words are displayed.<br><br>Thanks for your help.
 
Gee, I forget. I think I said to make sure you use brackets around the names and possibly eliminate the underscore from the field names. (In case they are being read as line continuations)<br><br>Are you sure you are spelling all of thenames right? The error you got would indicate you spelled something wrong.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top