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

Searching in Forms 1

Status
Not open for further replies.

Danielle17

Technical User
Apr 17, 2001
102
US
I have a database that contains the following fields:
Model#, Manufacturer, Description & Price
Both the Model# and Manufacturer fields could be repeated/duplicated. I need to search by manufacturer, have a subform pop up that would list all of the records for that particular manuf. Then I'd like there to be another combo box that allows the user to choose a model# and then be taken to that particular record in the subform.
This sounded easy (and maybe it is) but I'm a little stumped. I created this form with a combo box that calls up manufacturers. The only problem is that it lists the manufacturers as many times as they were entered into the db. I tried to run a query to get rid of the duplicates but then the combo box won't 'connect' with the subform to bring up the manufacturers. Before I can really do anything else I have to figure this step out first. ANY help would be appreciated.
 
When you build the SQL you need to use the keyword DISTINCT.

Example: SELECT DISTINCT tblEmp.name FROM tblEmp;

Obviously this will select the name only once even if it is included more than once. One perculiarity about DISTINCT is that I have not found a means of setting it in the query builder but go to view\SQL and add it to the SQL. It then works fine.

Steve King Growth follows a healthy professional curiosity
 
I have created a query using that exact code in the SQL statement. It will only work if that's the only field in the query. Once I add the other fields to the query it then shows all the duplicates. It makes sense why this happens....so I thought maybe I could just create the query with that field then have the subform pull up the right manufacturer but then it asks for a parameter(the ID which is the primary key) I tried to include this in the query and then hide it but it still does not work.
Once I figure out how to get the combo box to use the query sql and pull up the rest of the record I could then figure out how to search those specific records for a particular model #
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top