Solved

Populate listbox from query using vba

Posted on 2009-05-19
4
735 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
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…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

816 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now