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

having two drop down list.. related to each other

Status
Not open for further replies.

mk2lee1

MIS
Jul 8, 2003
51
US
Hi, I have this form called School based on table called School. And within this form I would like to have two drop down list. One for the region and one for the school name. These are the fields from the school table. What I need to do is by selecting the region, I would like the schoolName drop down list to show only within the region that I have selected. Anybody knows how to do this?
Thank you
 
Hey,

Try this one

write code in AfterUpdate event of cboRegion combobox:


cboSchool.RowSource = "SELECT DISTINCT region FROM School WHERE region='" & cboRegion & "'"

cboSchool.Requery




Hope this helps... :)
Hasu
(Trust on someone, someone will trust you!)
 
well i did as you told me to, but after i click the region.. nothing comes up in cboSchool..
this is my code

Private Sub Combo73_AfterUpdate()
Combo35.RowSource = " select distinct region from school where region ='" & Combo73 & "'"
Combo35.Requery
End Sub

where combo73 is region and combo35 is the school...
Can you help me on this?

Thank you~
 
thread702-604614

thread702-607839

thread702-597272

thread702-541606

"In America, anyone can become president. That's one of the risks you take." - Adlai Stevenson
 
Sorry! I made a mistake.

use school in place of region after distinct keyword.

Private Sub Combo73_AfterUpdate()
Combo35.RowSource = " select distinct School from school where region ='" & Combo73 & "'"
Combo35.Requery
End Sub

Hope this helps... :)
Hasu
(Trust on someone, someone will trust you!)
 
well i tried that code.. but it makes the school combo..blank after i click on region combo
do you know why?

Private Sub comboRegion_AfterUpdate()
Me.Combo35.RowSource = "select distinct school.schoolname from school where school.region = '" & Me.comboRegion & "'"
Me.Combo35.Requery
End Sub

this is my code
 
I tried your code as well. It's working fine. make sure you create adfterupdate event from comboRegion properties event box.

-Hasu
 
hey hasu
can i send my file to you.. can you look over what is wrong with it? I still couldn't figured it out. thank you
 
File has to be zipped and less than 2MB.
mail me on mistry.hasmukh@syncrude.com

Hope this helps... :)
Hasu
(Trust on someone, someone will trust you!)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top