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

How do I omit the data link to a form in my query/report?

Status
Not open for further replies.

Scoob55k

Technical User
Nov 16, 2005
62
0
0
US
I have a query to a report run from a "Report" form. The query is linked to the form for things like data range and other specific information that a user may like to view in the reports.

If the user wants all the data in a date range, how can I omit the link/criteria for the other fields in the form linked to the query?

I may have just confused myself on this, however I have the form open up with "All" in these other fields from the begining and allow a user to select specific data criteria for the report if desired. If I select specific data from each of these field on the form, it works fine. The problem arrises when I want the report to show all data by leaving the fields to "All" on the form.

I've worked around this before with IF statements, etc. in the code to go to a different report when "ALL" is in the field, but then I have to maintain multiple reports when changes are made. I would have to think that I can use just this one query/report to do all I need it to, but cannot come up with a solution. Your help and assistance is much appreciated!

Thanks!
 
How are you opening the report? Are you building a Where statement from the form? Have you seen FancyPrairie's FAQ on Where statements for reports?
 
I open the report using a command button. I'm not so much familiar with writing WHERE statements in code. The three fields I am getting criteria from on the form that I may or may not want are [BySection], [ByTeam], and [ByHandler]. I want the user to be able to select all three, just the Section & Team and get ALL the Handlers in that Team or just the Section which will provide ALL the Teams and Handlers for that section.

I have the form populate [BySection], [ByTeam], and [ByHandler] will "All" when the form is opened up. Right now I am in the process of developing 4 seperate reports and using an IF statement in the command buttons code to select which one is correct dependant on which fields have the data in them. Stinks when I am asked to make a change to the report 'cause then I have to change all 4 quiries and reports potentially.

Can you give me a link to the FAQ you stated above? I searched and couldn't find it. I guess I'm not certain what exactly you mean.

Thanks!
 
This one:
Build Report Criteria via a Form w/list box, text box, date range
faq181-5497

It will do pretty much the whole thing for you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top