Query Result in a ListBox (1 Viewer)

key

Registered User.
Local time
Today, 02:04
Joined
Jun 19, 2002
Messages
45
Hi Access-Friends,

I want to run a query and show the result in a listbox. Does anybody know how to do it?
Here is what I have:


....
(multiselect from a listbox)
.....

Set DB = CurrentDb()
'Set Q = DB.QueryDefs("Query11")
Q.SQL = "Select Field1 From Table1 Where [ID]=" & Criteria

Q.Close
DoCmd.OpenQuery ("Query11")

How I can change this code to show the result in a listbox?

I appreciate your suggestions,

Key
 

Travis

Registered User.
Local time
Today, 00:04
Joined
Dec 17, 1999
Messages
1,332
Set the Listbox's Rowsource equal to the Query you just created or set it equal to the SQL string of the Query.

Make sure that the RowType is set to Table/Query.

You might also need to modify the Column/Column Width properties.
 

Users who are viewing this thread

Top Bottom