Adding items in access combo box progrmmatically

J

Jack

Hi,
I am trying to add items to a Access combo box programatically as follows:

' Load the drop down
With cbTechnique
.AddItem "Orders by Customer (refresh method)"
.AddItem "Orders by Customer (CreateParameter method)"
.AddItem "Add an order detail item"
.AddItem "Get Revenue by week"
.AddItem "Add an order"
End With

But this seems to be not working. Any help is appreciated. Thanks in advance.
 
D

Dale Fye

Jack,

Generally, I shy away from building combo and list box lists
programmatically. It is much simpler to maintain if you build these lists in
tables and reference the table or a query based on a table as the rowsource
for the combo.

HTH
Dale
 
L

Linq Adams via AccessMonster.com

What version of Access are you using? AddItem (for this purpose) only became
available after v2000.

Where are you placing this code?
 
L

Linq Adams via AccessMonster.com

Meant to add, in versions where it can be used for this purpose, the combobox
Row Source Type has to be set to "Value List."
 
K

Klatuu

"seems to be not working"
is a bit vague.
What is not working?
Are you getting an error, if so, what error and on what line of code?
Where is this code?
How do you know it is actually executing?
What version of Access are you running?

Without the detail above, all I can answer is
"You're not doing it correctly"
 
J

Jack

Thanks to everyone who has given great advise. Actually I am using Access
2000 version. With this I believe I cannot do coding that I have done. I took
your advise and it works now. Regards.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top