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

Need to select one or many or all in a query ! 2

Status
Not open for further replies.

maverick

MIS
Apr 21, 1999
193
US
I have a report to print, but...<br>
I need to be able to select all records with TX., CA. or as many as I need at the time.<br>
I'm not sure how to do this...Query? criteria?<br>
Parameter subform? I'm blank on this...for some reason.<br>
<br>
I know in the query criteria you can put &quot; Like[Enter State]<br>
but you only get one choice!<br>
and it will ask you to enter state, but what if I want CA TX OR and tomorrow I will need just CA, and the next day I need all state. ????<br>
<br>
Thanks...
 
1. If you are going after specific values, such as FL, there is no need for the LIKE operator. That's just for if you want to return every value that contains the string FL. <br>
2. The &quot;in()&quot; operator just is an alternative to the &quot;or&quot; statement. If you are doing it manually in the query window, it just takes up a little less viewing space. <br>
3. The article mentioned above does pop up a form. It contains a listbox to display and collect the available values. The code checks for at least one value selected, concatenates all the values into a filter criteria, then removes the final comma after the last value.<br>
4. I'd be interested to see an SQL version if you'd like to post it. The more answers the better!
 
Thanks Tekies, Specialy Mav.....for your solution !<br>
<br>
This helped solve one of my problems !<br>
<br>
But I'm with &quot;mbuell&quot; Keep It Simple Stupids !<br>
<br>
Don't get me wrong I believe in erorr checking,<br>
But enough is enough and Mav's right there is always a simple way to do most things in Access !<br>
<br>
Even with erorr checking !<br>
<br>
kiss, kiss <p>Jessi<br><a href=mailto: > </a><br><a href= > </a><br>
 
Elizabeth makes a very valid point, some programmers can write 10 lines of code, which does a job as well as another programmers 30 lines. The quantity does not matter, its the quality. What about the poor person who comes to maintain your code. What saved you a couple of hours in writing costs somebody days or weeks later to decipher, I've been there!<br>
<br>
Maverick's code is an example - its is not that efficient, which is fair enough if he/she is just learning. The goal of a programmer should be good modular code, well commented and designed with the bigger picture in mind.<br>
<br>
C
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top