Combo Boxes

G

Guest

I have a subform which has several combo boxes on it. The first combo box
provides the name of a product. Each product has several grades. The products
are in one table (tblProduct) with fields ProductID (Autonumber) and Product.
The second combo box provides the names of product grades. Grades are in
tblGrades and have ProductID and Grades. It is a one to many relationship
(tblProducts being the one side tblGrades being the many side. After I have
chosen the product, the Grades combo box shows all the grades from all the
products. How can I get it to show only the grades from the product I have
chosen from the combo box?
 
L

Lynn Trapp

G

Guest

Lynn Trapp said:
The recordsource for your Grades combo box needs to be:

Select Grades
From tblGrades
Where ProductID = Forms!YourMainform.Form!YoursubForm!YourProductCombobox

Then you will need to requery the Grades combobox in the Change event of
your Products combobox.

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm
Jeff Conrad's Access Junkie List:
http://home.bendbroadband.com/conradsystems/accessjunkie.html






Thanks Lynn but it is still not working. I know it does work because I have used it several times before on different DBs. I have also used it on this DB in the main form to get customer addresses. All that happens is a "Enter Parameter Value" box appears with "Forms!frmOrders.Forms!fsubCategories!Product" written on it. When I enter the correct ProductID number it shows the corresponding grades. If I cancel it, it shows nothing.
 
G

Guest

No it's still not working. I've even tried it in VB with
"Forms!fsubCategories.Grade.Column(1) =
Form!fsubCategories.Product.Column(0)" but it comes up with the error message
"Can't find the field fsubCategories referred to in your expression" and I've
tried "Form_fsubCategories.Grade.Column(1) =
Form_fsubCategories.Product.Column(0)" But then I get the error message
"Object Required". There are several other variations of the above code I've
tried with similar results on all of them.
 
G

Guest

No It still doesn't want to know. I think I'm going to have change a few
things in the actual DB.
Thanks very much for your help. It is much appreciated.
Jim
 
K

Ken Snell [MVP]

Looks as if the poster did not strictly follow your recommendations
regarding use of ! not . in the suggested code. His last post indicates that
he left out the .Form. between the subform name and the control name. And
he's trying to set the "value" of the second column in the combo box's
RowSource to a value from the first column -- I don't think that can be
done.
 
G

Guest

I have managed to sort the problem out. All I did was to write in the
criteria box [cboProduct]. This has seemed to do the trick. I haven't got a
clue why the method you suggested didn't work Lynn. As I said I have used
that method on other DBs before and even on this DB.
Once again, Thanks very much for your help. I owe you one.
 

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

Similar Threads


Top