AddItem doesn't work in Access 2000
Hi,
I have a function (see below):
Private Sub PopulateCboYear()
Dim iYear As Integer
For iYear = 1900 To Year(Now())
cboYear.AddItem (iYear)
Next
End Sub
When I call PopulateCboYear, 4-digit years are populated to a combo box on the main form. The code works perfect until I tested it in Access 2000.
Is there anyway to modify the function so that it will work in Access 2000 or above?
Thanks a bunch!
Re: AddItem doesn't work in Access 2000
What's the error you're getting?
Re: AddItem doesn't work in Access 2000
Hi,
The .AddItem was highlighted and the error message said:
Compile error:
Method or data member not found
I created the code in Access 2003 (it worked perfectly), and just had a user who uses Access 2000 to test the code today (got error message).
Thank you,
egghi
Re: AddItem doesn't work in Access 2000
The regular combobox in Access 2K doesn't have a .additem method, like a VB6 one does. You'd have to use the ActiveX combobox, or add the items manually. Access 2003 standard combobox maybe does, don't know, don't have that. Or if you did use the ActiveX one, the user in 2K may not have references checked, or even have the .ocx file installed on their machine.
In general, trying to use code from a later version of a program in an earlier version will lead to lots more errors than a later version using earlier code.
Re: AddItem doesn't work in Access 2000
Thank you for the advice. I will look for a way to work around then.