Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I populate a listbox from SQL

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
My company's VBA expert left the company and all her Macros have been given to me (the Web Programmer/Developer who has NO knowledge of VBA). We have a Fax macro that I need to add a listbox in the dialogue box that displays all the project codes (these are pulled from SQL). If this is a silly question, I apologise, VBA is greek to me!
 
I populate a listbox by setting it's RowSource property to the select statement.

Eg:

Me!lstBox.RowSource = "SELECT [Field1], [Field2] FROM
WHERE [Field1] = 'Nothing'"
Me!lstBox.Requery

*Insert this line into the VBA Code. If the listbox is on the current form. Make sure your listbox has the Columns property set to the same number of fields in your select statement and that the table exists in your database. Hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top