Connecting Tech Pros Worldwide Forums | Help | Site Map

How do I set combobox data source to a dynamic SQL statement?

Newbie
Guest
 
Posts: n/a
#1: Oct 11 '06
I have a combobox on a form.

Coming from VB, I like to build a dynamic SQL statement and then set
the control's data source to the SQL statement.

Please tell me how to do that in access using the VB editor.

I have the dynamic SQL statement working fine, I just need to set the
control's source programatically.

Thanks in advance.

Rick Brandt
Guest
 
Posts: n/a
#2: Oct 11 '06

re: How do I set combobox data source to a dynamic SQL statement?


Newbie wrote:
Quote:
I have a combobox on a form.
>
Coming from VB, I like to build a dynamic SQL statement and then set
the control's data source to the SQL statement.
>
Please tell me how to do that in access using the VB editor.
>
I have the dynamic SQL statement working fine, I just need to set the
control's source programatically.
>
Thanks in advance.
If by "data source" you mean the rows displayed in the drop down list then
that is actually the RowSource property of the ComboBox. All you need is...

Me.ComboBoxName.Rowsource = "Your SQL"

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com


Newbie
Guest
 
Posts: n/a
#3: Oct 11 '06

re: How do I set combobox data source to a dynamic SQL statement?


On Wed, 11 Oct 2006 17:57:16 GMT, "Rick Brandt"
<rickbrandt2@hotmail.comwrote:
Quote:
>Newbie wrote:
Quote:
>I have a combobox on a form.
>>
>Coming from VB, I like to build a dynamic SQL statement and then set
>the control's data source to the SQL statement.
>>
>Please tell me how to do that in access using the VB editor.
>>
>I have the dynamic SQL statement working fine, I just need to set the
>control's source programatically.
>>
>Thanks in advance.
>
>If by "data source" you mean the rows displayed in the drop down list then
>that is actually the RowSource property of the ComboBox. All you need is...
>
>Me.ComboBoxName.Rowsource = "Your SQL"
Thanks.
Closed Thread