Buttons and Listboxes

  • Thread starter Thread starter DS
  • Start date Start date
D

DS

How do you set up a listbox that is filled by pressing a command button.
I have two buttons, if you press button 1, I want the listbox to fill
with certain info, press button 2, it would fill with other info. The
listbox would be based on a query.
Thnak You
DS
 
Using the OnClick event of each button, set the RowSource for the ListBox to
the individual SQL string you need.

YourListBox.RowSource = "SELECT DISTINCTROW tblYourTable.... etc... etc... "

hth
Al Camp
 
Use Qry1 for case 1 and Qry2 for case 2. Put this code in the click event of
button 1:
Me!NameOfListbox.Rowsource = "Qry1"
Put this code in the click event of button 2:
Me!NameOfListbox.Rowsource = "Qry2"
 
PC said:
Use Qry1 for case 1 and Qry2 for case 2. Put this code in the click event of
button 1:
Me!NameOfListbox.Rowsource = "Qry1"
Put this code in the click event of button 2:
Me!NameOfListbox.Rowsource = "Qry2"

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com
Great Thank You, running off to do it now!
DS
 
AlCamp said:
Using the OnClick event of each button, set the RowSource for the ListBox to
the individual SQL string you need.

YourListBox.RowSource = "SELECT DISTINCTROW tblYourTable.... etc... etc... "

hth
Al Camp
Thank You!
DS
 
Back
Top