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

Get values in Combo Box ...

P: 36
Hi All,

I have a combo box and a command button

In combo box i have to show values which i get frombelow query

Expand|Select|Wrap|Line Numbers
  1. SELECT Name FROM MSysObjects WHERE Type=5
if user select one and the same value is to be assigned to below code(bold)
Expand|Select|Wrap|Line Numbers
  1. DoCmd.OutputTo acOutputQuery, rs!Name, acFormatXLS, "" & fullpath & "\" & rs!Name & ".xls"
May 21 '09 #1
Share this Question
Share on Google+
4 Replies

Expert 100+
P: 1,287
Expand|Select|Wrap|Line Numbers
  1. If ComboBoxName.ListIndex >= 0 Then
  2.   DoCmd.OutputTo acOutputQuery, ComboBoxName, ...
  3. End If
May 21 '09 #2

Expert Mod 15k+
P: 31,707
What's the problem?

Is your code not working?

What about it isn't working?

Are there any error details you should have shared with us?
May 24 '09 #3

P: 36
Hi Chipr,

How to get
Expand|Select|Wrap|Line Numbers
  1.   SELECT Name FROM MSysObjects WHERE Type=5 
values into combo box ?

and then if user selects one in that the same value is to assaigned to ABC below

Expand|Select|Wrap|Line Numbers
  2. DoCmd.OutputTo acOutputQuery, ABC, acFormatXLS, "" & fullpath & "\" & ABC & ".xls" 
Jun 17 '09 #4

Expert 100+
P: 1,287
Can you not select the MSysObjects table in the combo box wizard?

If you reference your combo box in your code, by default it will return the value of the selected item. So,
Expand|Select|Wrap|Line Numbers
  1. Dim ABC As String
  2. ABC = NameOfYourComboBoxHere
If you have multiple columns in your combo box, you can get the value in a specific column with
Expand|Select|Wrap|Line Numbers
  1. ABC = NameOfYourComboBoxHere.Column(1)
The columns index starts with 0, so Column(1) is the second column.
Jun 17 '09 #5

Post your reply

Sign in to post your reply or Sign up for a free account.