Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    May 2002
    Location
    USA
    Posts
    190
    Thanks
    0
    Thanked 0 Times in 0 Posts

    User-defined type error (A2K/VBA)

    ok I have some code and I keep getting a User-defined type not defined error. Here is my code.

    Public Function RefreshSmartSearch()
    Dim CurDB As Database, GetData As Recordset, RestofArgs As String
    Set CurDB = CurrentDb()
    Me!OptionLabel1.Visible = False
    Me.Option1.Visible = False
    Me!OptionLabel2.Visible = False
    Me.Option2.Visible = False
    Me!OptionLabel3.Visible = False
    .....

    Any help would be appreciated. This code works for another database of the same type, but can't figure out why it won't work now.

  2. #2
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: User-defined type error (A2K/VBA)

    Check your Tools | References for a reference to ADO and/or DAO.

    The default object in Access 2000 is ADO, whereas 97 used DAO.

    You'll need to add DAO to the list of References and remove ADO (assuming you're not using it).

    Also, it's good practice to explicitly declare your variables by adding the object Prefix in front of them:
    Dim db as DAO.Database
    Dim rst as DAO.Recordset 'etc....

    HTH

  3. #3
    2 Star Lounger
    Join Date
    May 2002
    Location
    USA
    Posts
    190
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: User-defined type error (A2K/VBA)

    Thank you. After looking I realized the DAO control wasn't activated. I keep forgeting I need to set that damn thing up. Anyway many thanks.

Posting Permissions

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