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

values from one combo box determinds table look ups in the other......

Status
Not open for further replies.

springy2003

Instructor
Jan 30, 2003
67
GB
I am quite new to access so I am not sure on how to go about this, or is it remotely possible. I have a form (frmstore) that is use to enter data into a table that I have created (tbltable). One of the field is a primary key (auto number) and the other two are combo box. In the first combo box, there are four option to should from, which is taken from another table (tbltype) using the row source command on the form. The next bit is the tricky bit. I want the next commbo box to take values from a table that is determind by the value in the first combo box. For example, selecting "1" in the first combo box will tell the second combo box to take data from tblone (since tblone has the primary key from tbltype). Selecting "2" will tell second combo box to take data from tbltwo, etc. Is this possible to do??? Do I have to use the auto update function?
 
This is not a problem. Simply use the click() event on the first cbo to set the DataSource on the second and you have what you wish.

tblTwo = "tblSecond"
SQLstr = "SELECT * FROM tblTWO WHERE [SomeField = '"
SQLstr = SQLstr & me.cboFirstText & "';"

me.cboTwo.datasource = SQLstr

rollie@bwsys.net

check to see that datasource should not be rowsource in help
 
But what if I select "1" in the first combo box? In the second combo box, you should get the data from tblOne, not tblTwo if I am not mistaken (which I probably am). Anyway, the click event on the form requires a macro of some kind to work it, or am I wrong. Sorry for this but I not that good when it comes to access.
 
send me an email to the above address and I will send you an example.

Rollie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top