help with combobox AddItem method

S

shaw

Here I am using VBA code to generate a form and its controls. After a form
and comboboxes are created I want to add values to the comboboxes. AFter
setting the RowSourceType property of the combobox to "Value List", I use
AddItem method to add the values to the combobox.... But got following:
"Run-time error '2478'
<database name> doesn't allow you to use this method in the current view
What problem it is???

Thanks in advance!!
 
D

Dirk Goldgar

shaw said:
Here I am using VBA code to generate a form and its controls. After a
form and comboboxes are created I want to add values to the
comboboxes. AFter setting the RowSourceType property of the combobox
to "Value List", I use AddItem method to add the values to the
combobox.... But got following: "Run-time error '2478'
<database name> doesn't allow you to use this method in the current
view What problem it is???

Thanks in advance!!

Although I don't have my copy of A2002 handy at the moment, I believe
that the AddItem method (introduced with that version) is intended for
adding items on the fly, in form view. For creating a form and control
in code, after setting RowSourceType to "Value List", set RowSource to a
string containing a delimited list of values; e.g.,

With ctl
.RowSourceType = "Value List"
.RowSource = "This;That;The Other"
End With
 

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