?
Solved

Strange compile error on ComboBox.AddItem method

Posted on 2003-02-18
2
Medium Priority
?
528 Views
Last Modified: 2007-12-19
Access97: I created a fresh database with 1 form and no tables. The form has 1 control - an unbound combo box. You cannot get simpler than this.

Now, the form module has 1 line of code:

   Me.ComboBox.Additem "Item1"

When I compile the database I get a compile error saying ".AddItem method or data member not found".

I think this might have something to do with having installed Access 2002 - I'm still running 97. However, from what I understand there should be no problem running both versions...


In case it helps, the References in Access 97 are:

1. Visual Basic for Applications (..\common files\MS shared\VBA\VBA332.dll)
2. MS Access 8.0 Object Library (..\Office\MSACC8.OLB)
3. MS DAO 3.51 Object Library (..\common files\MS shared\DAO\DAO350.dll)


0
Comment
Question by:BigJ
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 41

Accepted Solution

by:
shanesuebsahakarn earned 300 total points
ID: 7980600
The AddItem method does *not* work with form combo boxes in A97. It only works for command bar combo boxes unfortunately. You'll need to use alternative methods such as adding the item to the source table or the combo box's value list.
0
 
LVL 2

Author Comment

by:BigJ
ID: 7985612
Cool. If anyone is interested, I used this code. It's untested but should work.

   Me.ComboBox.Rowsource = Me.ComboBox.Rowsource & "New Data;"
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question