Populate listbox from query using vba

Hi,
I have a form with a listbox (not visible). I would like to use a cmd button to make the listbox visible, then populate the list box with the results from a query.
The listbox name is lstJobSearch and the query is qryFindCompayJobsSearch.
The query asks for the Company perameters for the search.
Can u give me some guidlines on vba code. I am ok with the visible etc., but I don't know how to populate the listbox on demand, using the query (or similar method)
jwjjwjAsked:
Who is Participating?
 
jakemdrewConnect With a Mentor Commented:
Sorry, it is the rowsource property.

lstJobSearch.rowsource = qryFindCompayJobsSearch
0
 
jakemdrewCommented:
lstJobSearch. recordsource = qryFindCompayJobsSearch
0
 
jakemdrewCommented:
If you need to refresh the contents of the listbox:

lstJobSearch.Requery
0
 
jwjjwjAuthor Commented:
Thanks jakemdrew, worked like a dream. Had to put " around the query name.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.