Dynamic ListBox

L

LoyolaMsc2006

hi

i have to created dynamic List Box

Where one listbox is connected to table1

and another listbox is connected to table2,table3,table4



if i select first value of table1 ...the second list box should be
filled with table2 items

if i select second value of table1 ...the second list box should be
filled with table3 items

if i select third value of table1 ...the second list box should be
filled with table4 items
 
D

Douglas J Steele

In the AfterUpdate event of Listbox1, put code to set the RowSource for
Listbox2:

Private Sub Listbox1_AfterUpdate()

If Me.Listbox1.Selected(1) Then
Me.Listbox2.RowSource = "SELECT Field1 FROM Table2"
ElseIf Me.Listbox1.Selected(2) Then
Me.Listbox2.RowSource = "SELECT Field1 FROM Table3"
ElseIf Me.Listbox1.Selected(3) Then
Me.Listbox2.RowSource = "SELECT Field1 FROM Table4"
End If

End Sub
 

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

Top