A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Starting a new report based on a field.



 
 
Thread Tools Display Modes
  #1  
Old May 19th, 2004, 09:01 PM
ChuckA
external usenet poster
 
Posts: n/a
Default Starting a new report based on a field.

What I am attempting to do is when the info. within a field changes perse from 9506 to 9708 that it begins to print a new report based off the next number in line. I have a db setup where we keep track of all our vehicles and everything pertaining to them (gas used, miles drove, etc.). What we need is for when the next vehicle number comes up that the report basically starts printing fresh (right now I enter the begin date, end date, and vehicle number for the report parameters - but would like to remove the vehicle number so it just prints the reports for all vehicles instead of having to do them one at a time), from the next vehicle number is reached. Any help is greatly appreciated. Thanks.
  #2  
Old May 19th, 2004, 10:33 PM
Marshall Barton
external usenet poster
 
Posts: n/a
Default Starting a new report based on a field.

ChuckA wrote:

What I am attempting to do is when the info. within a field changes perse from 9506 to 9708 that it begins to print a new report based off the next number in line. I have a db setup where we keep track of all our vehicles and everything pertaining to them (gas used, miles drove, etc.). What we need is for when the next vehicle number comes up that the report basically starts printing fresh (right now I enter the begin date, end date, and vehicle number for the report parameters - but would like to remove the vehicle number so it just prints the reports for all vehicles instead of having to do them one at a time), from the next vehicle number is reached. Any help is greatly appreciated. Thanks.



Generally, a separate report for each something is not a
good idea, but you may have special circumstances that you
didn'e explain.

The typical approach is to specify the vehicle ID in a Group
level (View - Sorting and Grouping menu item). If you also
set the group to include a group Header and/or Footer
section, then you can use that section's ForceNewPage
property to start each one on a new page.
--
Marsh
MVP [MS Access]
  #3  
Old May 20th, 2004, 02:41 PM
ChuckA
external usenet poster
 
Posts: n/a
Default Starting a new report based on a field.

Basically what my boss wants is a seperate report for each vehicle in the database. As its set up now I can produce this report but I have to manually enter each and every vehicle number in the condition parameters I have setup (begindate, enddate, and vehicleid). What I want (and havent figured out how to do) is set it all up so i can remove the vehicle Id part and as the report gets to the next vehicle number in line it automatically starts a new report for that number. Thanks for any help.
  #4  
Old May 21st, 2004, 05:11 AM
Marshall Barton
external usenet poster
 
Posts: n/a
Default Starting a new report based on a field.

ChuckA wrote:

Basically what my boss wants is a seperate report for each vehicle in the database. As its set up now I can produce this report but I have to manually enter each and every vehicle number in the condition parameters I have setup (begindate, enddate, and vehicleid). What I want (and havent figured out how to do) is set it all up so i can remove the vehicle Id part and as the report gets to the next vehicle number in line it automatically starts a new report for that number. Thanks for any help.



Oh boy! This is the second question today that I don't have
a good answer for. It is very difficult (and not especially
reliable) to generate multiple variations of the same report
using code. The OpenReport method will just give the focus
to a report that's already open. The approach of opening
multiple instances of the same report is a tricky affair at
best.

If you are printing the report directly to the printer (not
previewing) then you could use a code loop that checks if
the report is still printing a previous vehicle before
opening it again. Assuming you have some sort of list of
the vehicles, you could loop through the list and issue an
OpenReport (using the WhereCondition argument to specify the
vehicle) then use the SysCmd function to check if the repot
is closed before going around the loop for the next vehicle.
Something like this air code might do it:

For Each vehicle In somecollection
DoCmd.OpenReport "reportname", , ,"VID =" & vehicle
Do
DoEvents
Loop Until SysCmd(acSysCmdGetObjectState, _
acReport, "reportname") = acObjStateOpen
Next vehicle

I hear what you're saying about what the boss wants, but how
can he tell if he gets a pile of separate printouts or a
single printout that contains the same pages???
--
Marsh
MVP [MS Access]
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 03:28 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.