Home All Groups Group Topic Archive Search About
Author
23 Feb 2005 4:52 PM
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

Author
23 Feb 2005 5:01 PM
AlCamp
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

Show quote
"DS" <booty***@optonline.net> wrote in message
news:WA2Td.2666$qY2.377@fe09.lga...
> 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
Author
23 Feb 2005 6:53 PM
DS
AlCamp wrote:

Show quote
> 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
>
> "DS" <booty***@optonline.net> wrote in message
> news:WA2Td.2666$qY2.377@fe09.lga...
>
>>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
>
>
>
Thank You!
DS
Author
23 Feb 2005 5:08 PM
PC Datasheet
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
                              resou***@pcdatasheet.com
                                 www.pcdatasheet.com


Show quote
"DS" <booty***@optonline.net> wrote in message
news:WA2Td.2666$qY2.377@fe09.lga...
> 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
Author
23 Feb 2005 6:50 PM
DS
PC Datasheet wrote:
Show quote
> 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
>                               resou***@pcdatasheet.com
>                                  www.pcdatasheet.com
>
>
> "DS" <booty***@optonline.net> wrote in message
> news:WA2Td.2666$qY2.377@fe09.lga...
>
>>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
>
>
>
Great Thank You, running off to do it now!
DS

AddThis Social Bookmark Button