Assign predefined query

H

Hajo

Hi,

under Queries, I defined a working query, named qryTest. Now I want to
assign this query to a ListBox.
I do it like this:
lstBoxTest.rowsource=qryTest

But that doesn't work. I guess I have to identify qryTest better?!

Thank you,
Hajo
 
L

Larry Linson

Why do you not go to the properties sheet for the listbox, and select the
query when you click Row Source?

It might be that, in code, you have to identify "lstBoxTest" better... if
you are in code for the Form in which lstBoxTest resides,
Me.lstBoxTest.RowSource = qryTest, or, if not,
Forms!nameoftheform!lstBoxTest = qryTest.

Larry Linson
Microsoft Office Access MVP
 
Top