Results 1 to 5 of 5

Thread: AddItem doesn't work in Access 2000

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Sep 2006
    Posts
    21

    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!

  2. #2
    Hyperactive Member
    Join Date
    Oct 2006
    Location
    USA
    Posts
    476

    Re: AddItem doesn't work in Access 2000

    What's the error you're getting?

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Sep 2006
    Posts
    21

    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

  4. #4
    Frenzied Member
    Join Date
    Feb 2003
    Location
    Argentina
    Posts
    1,950

    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.
    Tengo mas preguntas que contestas

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Sep 2006
    Posts
    21

    Re: AddItem doesn't work in Access 2000

    Thank you for the advice. I will look for a way to work around then.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width