Two Connecting combo boxes via VBA

noble

New member
Local time
Today, 09:51
Joined
Dec 4, 2012
Messages
9
Hi

I have two combo boxes in a single form, they are connected to different tables, I wand one of them change it's fields when I choose any special field in the other combo, as a matter of fact I want them to be dynamic.

for example if I choose field #1 in combo #1 (from table #1), fields #1 and #2 from table #2 should appear in combo #2
and if I choose field #3 in combo #1(from table #1), fields #5 and #6 from table #2 should appear in combo #2

anybody please help me?
 
Is this what you're looking for?



hey!
I followed the instructions! but it didn't work :(
is there any special tip or smth else I should do before using the VBA codes?

my tables are:
tblStudent : sID(key),sName,sAvg
tblCourse: cID(key),cName,type,unit
tblchoose: ID(key),sID(forein key),cID(foreign key)

in the form I have two combos and a text box
cboStuddent and cboCourse and txtstID

I want the txtstID to show the student's ID when the user selects the student's name from cboStudent and the cboCourse to show the courses that student have chosen ( which indicates in the tblChoose table)

as a matter of fact! I wanna the cboCourse filtered by the cboStudent's values

what prior settings I need to do so?

thanks
 
hum! this is what I meant by "didnt work"!
I leave my database and follow this page instructions :
h*ttp://msdn.microsoft.com/en-us/library/office/bb404901(v=office.12).aspx

but the cboProducts didnt show the filtered values! and the two comboes didnt connect at all!
is there any other tip I should know about tha tables or relationships?

Oh! btw that textfield is not my problem anyway, I dont care it n I could omit it!
 
hey!
I followed the instructions! but it didn't work
is there any special tip or smth else I should do before using the VBA codes?

my tables are:
tblStudent : sID(key),sName,sAvg
tblCourse: cID(key),cName,type,unit
tblchoose: ID(key),sID(forein key),cID(foreign key)

in the form I have two combos and a text box
cboStuddent and cboCourse and txtstID

I want the txtstID to show the student's ID when the user selects the student's name from cboStudent and the cboCourse to show the courses that student have chosen ( which indicates in the tblChoose table)

as a matter of fact! I wanna the cboCourse filtered by the cboStudent's values

what prior settings I need to do so?

I have two combo boxes in a single form, they are connected to different tables, I wand one of them change it's fields when I choose any special field in the other combo, as a matter of fact I want them to be dynamic.

for example if I choose field #1 in combo #1 (from table #1), fields #1 and #2 from table #2 should appear in combo #2
and if I choose field #3 in combo #1(from table #1), fields #5 and #6 from table #2 should appear in combo #2

anybody please help me?
 
Can you post the db here with the failed effort?
 
yes!
here's the attached DB
please take a look at relations and VBA code for cboCategories
 

Attachments

Hard to test when the tables are empty, but you don't have CatID included in the first combo, so it's not available for the second.
 
would u plz make changes needed in the form and tables and attach the db back to me?

I don know how to include the catID to the 1st combo
I am a very begginer
will be full of thanks :)
 

Users who are viewing this thread

Back
Top Bottom