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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change list box recordset

Status
Not open for further replies.

dominicg123

Technical User
Jan 5, 2007
23
CA
I would like to change a list box recordset used on my form. The record set will have to be base on a combo box. This combo box is filled with a list of field used in my table.

This is the code so far:

ListeClient.RowSource = "SELECT Clients.RéfContact,xxxx FROM Clients ;"

I want to replace xxxx with the value in the combo box but I am new to VBA.

Please help, Thank you
 
Hi, dominicg123,

Something like this:
Code:
ListeClient.RowSource = "SELECT Clients.RéfContact, [red]'" & Me!MyCombo & "'[/red] FROM Clients ;"
...where [red]MyCombo[/red] is the name of your combobox. Note the single quotes - this assumes string data in your combo. If your combo is numeric, omit the single quotes; if it is a date/time, use # instead of single quotes.

HTH,

Ken S.
 
ListeClient.RowSource = "SELECT RéfContact, " & Me![yourCombo] & " FROM Clients"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top