Queries searching the ID and not the field text....

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm sure this is a common problem solved many times on here but I wasn't sure
what terminology to search for.

So my problem is this, I have a table called products which has the fields
ProductID and ProductName. I then have an Orders and Order_Details table
which has a field referring to the ProductID, but when I run a query to
search for all orders of a particular product, the user has to enter the
ProductID and not the ProductName, how do I solve this?
 
You need a query that has a field that has ProductName as its source plus the
fields that you want from orderdetails. In the criteria for the productname
field enter an open ended statment (ie one with no value) eg [Please enter
Product Name]. Also you need to Group by Product Name, you will have to do
this in SQL view by adding: GROUP by ProductName at the end
 
If the user currently has to type the ID you could easily change the textbox
to a combobox which would be based on a apery alpha sorted on the names in
your products table. You can hide the ProductID field and just show the
product name. Make ProductID the first field and make sure that your
combobox has column 1 as the bound column. In the field widths set them to
something like 0;1 That hides the ProductID number but leaves the Product
value in the combobox.

HTH
--
-Larry-
--

rico said:
You need a query that has a field that has ProductName as its source plus the
fields that you want from orderdetails. In the criteria for the productname
field enter an open ended statment (ie one with no value) eg [Please enter
Product Name]. Also you need to Group by Product Name, you will have to do
this in SQL view by adding: GROUP by ProductName at the end

Richard Horne said:
I'm sure this is a common problem solved many times on here but I wasn't sure
what terminology to search for.

So my problem is this, I have a table called products which has the fields
ProductID and ProductName. I then have an Orders and Order_Details table
which has a field referring to the ProductID, but when I run a query to
search for all orders of a particular product, the user has to enter the
ProductID and not the ProductName, how do I solve this?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top