Results 1 to 5 of 5
  1. #1
    Chuck T is offline Novice
    Windows 10 Office 365
    Join Date
    May 2021
    Posts
    2

    Dim rst as Recordset returning error as a user defined type not defined

    Our company is requiring me to move my Access apps to a new server. When I test it in the new location, the commands Dim rst as Recordset and Dim db as Database both return compile errors that the "user defined type" is not defined. Using DAO.Recordset does not fix it. Is there something needed to be added to or selected in the Office 365 setup on the new server to make Access recognize these statements? Thanks!

  2. #2
    Chuck T is offline Novice
    Windows 10 Office 365
    Join Date
    May 2021
    Posts
    2
    After looking at some other posts, I changed my code to simply Dim rst and Dim db, then set them later. That worked. Apparently Dim xx as xx is not the way to go any longer?

  3. #3
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,773
    Probably a reference, but I neve know which one?
    I'd also say being specific is better than not?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  4. #4
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,651
    IIRC, DAO is now part of the Microsoft Office 16.0 Access database engine Object Library, which I thought should be selected by default. Check to see that it is referenced. I also recall that you cannot reference DAO libraries in versions 2016 and up if that one is already selected - perhaps even a bit earlier.
    Last edited by Micron; 05-10-2021 at 01:25 PM. Reason: clarification
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  5. #5
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,449
    Maybe Dim rst as Object

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Compile error User-defined type not defined
    By Ashfaque in forum Modules
    Replies: 8
    Last Post: 03-03-2021, 03:37 AM
  2. Replies: 4
    Last Post: 10-16-2017, 09:09 AM
  3. DAO ERROR - User Defined type not defined
    By adamtate94 in forum Programming
    Replies: 2
    Last Post: 09-08-2016, 05:42 AM
  4. Replies: 3
    Last Post: 11-12-2013, 04:13 PM
  5. Replies: 4
    Last Post: 06-08-2012, 09:08 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums