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

combo box query search 1

Status
Not open for further replies.

l3reacher

Technical User
Jun 28, 2003
83
US
Hi, I've been trying to find ways to make my database small in size and have less queries to be created, but the only way I can make this work will make the database bigger, and more queries, which will cause a mess..
What I want to do is I have a table called "tblTraining” and inside the table are fields called “Classes” “StuNames” and “Date started ”. Under the field “Class” are data “CCNA, “MSCE, “MCP”, “A++, ”Linux”, and “MCSA”, “Excel”, and “Word”.

The field “Class” is a combo box which gets the data from “tblClass” Now what I want to do is I want to have only one form and one query that can do a simple job search, which I think is possible to do, but I just can’t find the method to do this..
I already created a query called “qryTraining” which captures all of the fields and data from the table “tblTraining”. I created a form called “frmViewQuery”, and in this form, I have created a combo box and a command button(cmdView) to do a search based on the data that I have given. “CCNA,“ “MSCE,” “MCP,” etc.
To make my question clearer, I’ll give an example. I go to my form, and there is a combo box called “cboClass” which gets the data from “tblClass” Inside the cboClass are “CCNA, “MSCE, “MCP”, “A++, ”Linux”, and “MCSA”, “Excel”, and “Word”. Now, For example, when I select MCP under the combo box and hit the cmdView, the query pops up showing the students who are taking the MCP class only.
If I choose CCNA in the combo box and hit enter, my query will come up showing the all the students with CCNA classes. Any ideas of how I can get this done??? Thank you!!



I Hate Spammers and Flammers!!!
 
If I understand you correctly, you just want to see only the criteria that you select in your combo box on the report - If that is the case, in your query under the field that you want to sort on put:

[forms]![frmViewQuery]![cboclass] or [forms]![frmViewQuery]![cboclass] is null

This will filter the query based on your combo box named cboclass - if you leave the combo box blank, it will give you all .

Hope that is what you are looking for.

Fred
 
Thank you very much!! this is exactly what i want. Thanks alot!!! :)

I Hate Spammers and Flammers!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top