Can set listbox data but not combobox data in vba

Margarita

Registered User.
Local time
Today, 16:40
Joined
Aug 12, 2011
Messages
185
Hello,
I am able to set the recordset of a listbox in the on load even of my form:

Me.PONumtoSearch.RowSource = " sql here..."

but when I try with a combobox, the combobox is blank for all records on the main form

Me.Itemstosearch_combo.ControlSource = " sql here... "

Why won't a combobox take a recordset from vba?

I have also tried approaching the combobox with a stored query:

Me.Itemstosearch_combo.controlsource= qdf_itemstosearch.openrecordset

but that just gives me a runtime error 91 (variable or with block not set).

Thank you in advance for your insights and suggestions.
 
I think you need to be setting the Row Source property of the combo box, as you would for a list box
 
Jesus, you're right! Thank you! I feel ever so slightly embarrassed....
 
Jesus, you're right! Thank you! I feel ever so slightly embarrassed....
IMHO You should not feel that way. I have yet to meet someone that can honestly say that they have never got muddled or make a mistake :).
 

Users who are viewing this thread

Back
Top Bottom