Solved

Populate listbox from query using vba

Posted on 2009-05-19
4
748 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
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…

738 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