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

List Boxes..

Status
Not open for further replies.

sansari

Programmer
Oct 16, 2003
5
0
0
US
HI
I'm trying to display a column of a query in a list box.. it should work like this.. i select something from a combo box and press a command button and the result should be displayed in a list box on the same form.. anyone can help??

right now i'm just running a mcro that opens the query results in a datasheet view.. hope to get a reply soon..thanks
 
Hi

JUst set the rowsource of the liit box to the query in question, or to a query with only one column, based on the query

In the command button (where you presumaby execute the query?) ensure you have a listbox.requery, where listbox is the name of your list box

Why not use a sub form instead of a list box ?

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
In the Click Event for the button (or you can use the After Update Event in the Combo box you would use an expression like this
Dim strSQL as String
strSQL = "Select * From MyTable Where MyTable.MyField = '" & Me.ComboBoxName & "'"
Me.ListboxName.RowSource = strSQL


If the value in your combo box is a number, take the single quote marks out of the expression. If it's a date value then replace the single quote marks with the # sign.

Paul
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top