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

Fill ComboBox using VBA

P: 20
Hi, every one

I have a combobox called "Me.Cuadro_combinado17" in ACCESS 2003

How can I add a list via VBA

I need to fill it with the next list

"Cat"
"Dog"
"Fish"

How can I do it?
Feb 12 '10 #1
Share this Question
Share on Google+
4 Replies


mshmyob
Expert 100+
P: 903
Basically set your RowSource property for the combo box:

Simplified version like so

Expand|Select|Wrap|Line Numbers
  1. Dim strRowSource as String
  2.  
  3. strRowSource = "Cat;Dog;Fish"
  4. Me.Cuadro_combinado17.RowSource = strRowSource
  5. Me.Cuadro_combinado17.Requery
  6.  
  7.  
cheers,
Feb 12 '10 #2

P: 20
Thank you so much it works perfect
Feb 15 '10 #3

mshmyob
Expert 100+
P: 903
You're welcome.

cheers
Feb 15 '10 #4

beacon
100+
P: 579
Personally, I would prefer to use a table for values like you listed cynicon and then write a SQL statement that populates the combobox using mshmyob's method.

This prevents you from having to hard code the values, which I've always been taught to avoid if at all possible.
Feb 15 '10 #5

Post your reply

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