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

Date parameters in report and subreport

Status
Not open for further replies.

My57chevy

Technical User
Jun 8, 2004
3
US
I've created two queries to accomplish what I felt I needed to create an accurate report. One query uses totals and a "between and" date parameter - this is used as my main report. The other query is not totaled but uses the same date parameter - I used this query to build a subreport. Needless to say when I tried to open my report, the prompted date parameter had to be entered a number of times and then failing to give me the correct information. I've tried several solutions: removing parent/child links; referring subreport control source to the main report, etc. but nothing works. What I want is to enter the date criteria once and have it work for both the main and subreport and give me correct information. I'm note sure how much more information I need to give. I've already spent way too much time on what I feel has to be a very simple solution - please help!
 
Have you considered basing your queries on a form instead of paramaters entered at run time? This makes things run much cleaner.

If you make a form, call it MyReport, and make two unbound Text Boxes formated to dates, call them From and To, then in your query, instead of [enter start] you put >= or Between Forms!MyReport!From and To.

You can have the report based on 10 different queries, all using the Form for the dates.

ChaZ

Ascii dumb question, get a dumb Ansi
 
Thanks for the quick response. I must be missing something in your process. I'm coming up with a message: "This expression is typed incorrectly, or it is too complex to be evaluated. For example, a numeric expression may contain too many complicated elements. Try simplifying the expression by assigning parts of the expression to variables." I've double-checked my typing and it appears to be OK. Your process sounds like it would be a life-saver for many different reports - if we can get it to work. I named the first unbound text box "Beginning Date" and the second "Ending Date". I left the control blank - is this correct?
 
Yes, but as a rule of course, I do not recomend ever assigning a name to anything using spaces.

In your case, be sure your query refers to the forms Begening date, and ending date with brackets, like this [begening date] and [ending date].

I did not use the brackets in my example, I appologize.

If the names had no spaces or other control charachters / reserved words, the query would have placed them there for you.

Hopefully this is the problem you are having.

ChaZ

"When religion and politics ride in the same cart...the whirlwind follows."
Frank Herbert
 
Thanks again! I'm getting closer to what I want. What I'm trying to do now is create a macro to run the date form after I opened the report instead of having the date form open and running before I open the report (make sense?) I'm still having trouble, but feel this is the better way to do it. A little history - the design of the db and its switchboard have already been done - I'm a latecomer to the scene and tweeking a bit and creating new reports when asked. There are already 10+ reports made with date criteria available to the staff - I want to keep this report as similar to open as they are alaready familar with. If I give up on the macro idea and use the form you suggest, I assume that the command button on the switchboard used to print the report I created would just be directed to the date form first for opening? I know this message is lengthy - but really appreciated your help!
 
Well, I don't know of a way to open the report first as you suggest, but what you can do is make the after update event on the forms date field launch the report. So as soon as they enter a date and hit enter, it opens the report, then closes the form.

ChaZ

"When religion and politics ride in the same cart...the whirlwind follows."
Frank Herbert
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top