467,888 Members | 1,399 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,888 developers. It's quick & easy.

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

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
  • viewed: 9159
Share:
2 Replies
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
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.

Similar topics

6 posts views Thread by Omar | last post: by
3 posts views Thread by Bill C. | last post: by
2 posts views Thread by pei_world | last post: by
1 post views Thread by fiaolle | last post: by
reply views Thread by MrMoon | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.