Solved

Populate listbox from query using vba

Posted on 2009-05-19
4
742 Views
Last Modified: 2012-06-21
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)
0
Comment
Question by:jwjjwj
  • 3
4 Comments
 
LVL 3

Expert Comment

by:jakemdrew
ID: 24428168
lstJobSearch. recordsource = qryFindCompayJobsSearch
0
 
LVL 3

Accepted Solution

by:
jakemdrew earned 500 total points
ID: 24428179
Sorry, it is the rowsource property.

lstJobSearch.rowsource = qryFindCompayJobsSearch
0
 
LVL 3

Expert Comment

by:jakemdrew
ID: 24428185
If you need to refresh the contents of the listbox:

lstJobSearch.Requery
0
 

Author Closing Comment

by:jwjjwj
ID: 31583328
Thanks jakemdrew, worked like a dream. Had to put " around the query name.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question