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

Drop down list box

Status
Not open for further replies.

soojosie

Programmer
Dec 22, 2002
21
AU
Can someone explain to me what has happened to my question about drop down list boxes?
I wanted to know how to get the 2nd list box to be populated depending on selection from the 1st list box. e.g. if flowers were to be selected in the first list box then the second would show flower varieties?
I'm a newbie to this site. I saw it posted about 12 hours ago and now I can't find it.
[ponder]
 
I can't tell you what happened to your post, but to accomplish what you want you will need something like this in the AfterUpdate Event for the first Listbox.

Dim strSQL as String
strSQL = Select * From MyTable Where MyTable.MyField = '" & Me.ListBox1 & "'"
Me.ListBox2.RowSource = strSQL

You will have to fill in the names of the Tables and Fields and Listboxes. The syntax is written for text values which I assumed your data was.

Paul
 
Hi,

If the base qry for the second combobox includes the first combo as a criteria, then all you need to do is refresh the dataset after you have updated the first combo.

On the afterUpdate event for the firstcombo, use

me.secondCombo.requery

which will refresh the dataset in the combo.

You should also clear the value in the second combo, otherwise their is high potential for the two related values to be out of sync.

Cheers

Steve
 
Go to m/s knowlegde dbase. search for syncronize combo boxes.

Great script easy to follow.

Scott
 
thanks so much for all the help I received, sorry about confusing start.
As a very recent ex-student I have so much to learn and having a site like this to check out is a great help to the nerves.
Thank you [thumbsup2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top