Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

access drop down box

Status
Not open for further replies.

rgandy

Technical User
Nov 17, 2005
38
US
I have created a drop down box. (control box)

When i try to "additem" with this object, it returns "permission denied"

I have never seen this before

Can someone please offer some advice as to why this is happening?

thanks
 
If you are using Microsoft Access (VBA) additem is not an option. You must either set a value list or use a table of query as a row source.
 
Additem works fine for me on a combobox control on a form. How are you using it?
 

pbrodsky, are you using it to add items to a combo box that is part of a CommandBar? From Access Help:

AddItem Method

Adds a list item to the specified command bar combo box control.

In Access VBA (unlike straight VB) it only works for combo boxes that reside on command bars.



The Missinglinq

Richmond, Virginia

There's ALWAYS more than one way to skin a cat!
 
I never actually modified command bars using code, but the Visual Basic Help gives an example that uses additem.

from the Access Visual Basic Help

"The following example adds two items to the second control on the command bar named "Custom," and then it adjusts the size of the control.

Set combo = CommandBars("Custom").Controls(2)
With combo
.AddItem "First Item", 1
.AddItem "Second Item", 2
.DropDownLines = 3
.DropDownWidth = 75
.ListIndex = 0
End With
 
The following example adds two items to the second control on the command bar named "Custom," and then it adjusts the size of the control.

Yes, like I said, this is for a combo box that is part of a Command Bar! That does not apply to combo boxes that are not part of Command Bars! The combo boxes that you place, free standing, if you will, are not on Command Bars!

AS crazy as it seems, Visual Basic and Visual Basic for Applications is not always the same!

The Missinglinq

Richmond, Virginia

There's ALWAYS more than one way to skin a cat!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top