By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,463 Members | 3,115 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,463 IT Pros & Developers. It's quick & easy.

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

P: n/a
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.
Oct 11 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Newbie wrote:
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
Oct 11 '06 #2

P: n/a
On Wed, 11 Oct 2006 17:57:16 GMT, "Rick Brandt"
<ri*********@hotmail.comwrote:
>Newbie wrote:
>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.
Oct 11 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.