Connecting Tech Pros Worldwide Forums | Help | Site Map

Where command help

Newbie
 
Join Date: Mar 2008
Posts: 3
#1: Mar 11 '08
ok here is the question i have a code

sub
DoCmd.OpenReport "Report A", acNormal, , "[Medical Record #]=" & Medicalrec & " AND [Arrival time]=" & AT _
& " AND [Date Assessment Completed]=" & "#" & DAC & "#"


DoCmd.OpenReport "Report b", acnormal, , "[Medical Record #]=" & Medicalrec & " AND [Arrival time]=" & AT _
& " AND [Date Assessment Completed]=" & "#" & DAC & "#"
end sub

and this code is suposed to print the report based on the information given in the form
the problum is that when it moves to the next report it askes for the information in the form of a input box not from the specifiyed fields

thanx for taking a look

Moderator
 
Join Date: Feb 2008
Location: Beauly, near Inverness, Scotland
Posts: 1,576
#2: Mar 11 '08

re: Where command help


Quote:

Originally Posted by Lokerin

Expand|Select|Wrap|Line Numbers
  1. sub
  2. DoCmd.OpenReport "Report A", acNormal, , "[Medical Record #]=" & Medicalrec & " AND [Arrival time]=" & AT _
  3. & " AND [Date Assessment Completed]=" & "#" & DAC & "#"
  4.  
  5. DoCmd.OpenReport "Report b", acnormal, , "[Medical Record #]=" & Medicalrec & " AND [Arrival time]=" & AT _
  6. & " AND [Date Assessment Completed]=" & "#" & DAC & "#"
  7. end sub
  8.  
...the problum is that when it moves to the next report it askes for the information in the form of a input box not from the specifiyed fields

Hi Lokerin. Since the two calls to OpenReport are identical other than the report title, it suggests there might be field differences in the two reports. OpenReport will pop up a parameter box for the user to fill in any missing fields, so note down the name of the field or fields you are asked for, then check that report B includes all of the same fields with the same titles as report A. The recordsource does not have to be the same for both reports, although if it is this will make tracking down your error a bit easier, but at the very least the fields [Medical Record #], [Arrival Time] and [Date Assessment Completed] must be present in Report B for the OpenReport call as listed to work correctly.

(I added code tags to the extract from your post above to make it clearer to read.)

-Stewart
Reply