Additem on Combobox causes a compile error

jayke

Registered User.
Local time
Today, 11:47
Joined
Nov 19, 2003
Messages
29
Additem on ListBox causes a compile error

Hi,

I am create a project on Windows XP in which I use Listboxes. The rowsource of the Listboxes are "value list".

example:
If txtAddPlb_tabVestiging.Value <> "" Then
Form_VestigingenForm.lstPlbEdit_tabVestiging.RowSourceType = "Value List"
Form_VestigingenForm.lstPlbEdit_tabVestiging.AddItem Form_VestigingenForm.txtAddPlb_tabVestiging.Value
Form_VestigingenForm.lstPlbEdit_tabVestiging.Requery
txtAddPlb_tabVestiging.Value = ""
Else

Everything works fine on XP. But now that I am almost finished with my project I tried to run it on a Windows 2000 system and .... I get a compile error.

"Method or data member not found"

Can somebody help me?

greetz
 
Last edited:
have you checked if you have any missing references ?
 
missing reference to what?

I created a new project under Access 2000 but here also I don't see any AddItem attribute in the list of available actions.
 
Dear Jakye,
Have you solve your problem? i face the same problem like yours in Window 98SE with Office 2002. I have include all the library needed but still cannot. FYI, my application run well in XP. Any idea how to solve this? really hope to hear from you soon. thanks.

regards
blchoo
 
Hi blchoo,

Yes I found a solution for this problem!
Access 2000 and previous versions don't work with .additem.

so a nice loop like below will not work:
do while NOT rsRecordset.EOF
lboList.additem = rsRecordset("Name")
loop


You can solve it by doing this:
do while NOT rsRecordset.EOF
s_str = s_str & rsRecordset("Name") & ";"
loop
lboList.rowsource = s_str


Note: when you have a lot of items to add to your listbox you get another problem!!!

The solution to that is to create a table runtime and fill in alle the items in that table.

I hope I could help you

Regards
 
Why not have a dedicated table for this in the first place rather than have a Value List?
 

Users who are viewing this thread

Back
Top Bottom