Listbox Add method dissapeared!

G

Guest

Hi everybody:

I've programmed code for a form at home under Access 2003 involving a list
box control.

When we try to run the form at the office (under Access 2000), the code
stops at this line:

List01.add ...

Access tells us "Compilation error. Method was not found".
In the code window, if we type the dot then the writing code assistant
displays the list with all the properties and methods and "Add" method seems
to be dissapeared. The first four lines are:

..addcolon
..afterupdate
..application
..autolabel

What´s wrong? Will it be a references problem? The first time we opened the
DB we had to change the latest ones from Access 2003 to the older ones under
Access 2000. The actual references loaded are:

VBA
OLE Automation
MS Access Library 9.0
MS ActiveX Data Objects Library 2.5
MS ActiveX Data Objects Recordset Library 2.5

Thanks in advance

Carrington
 
D

Douglas J. Steele

First of all, it should be List01.AddItem, not List01.Add

However, the problem you're running into is that the AddItem method wasn't
introduced into Access until Access 2002.

Rather than

List01.AddItem "something to add"

you could try using

List01.RowSource = List01.RowSource & ";" & "something to add"

That should work in both Access 2000 and Access 2003. Unfortunately, I
believe Access 2000 may have a lower limit to how much can be put into the
RowSource than Access 2003 (IIRC, they increased the size of the property at
the same time they added the AddItem method)
 

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