Results 1 to 6 of 6

Thread: Simple Declaration Question

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jul 2001
    Posts
    18

    Question Simple Declaration Question

    I was wondering what the correct variable type would be within the declarations section for the following variables:

    ************
    Set DB = DBEngine.Workspaces(0).Databases(0)
    ***********
    Set Table = DB.openrecordset("Registered Students Table", DB_OPEN_DYNASET)
    ************
    I'm pretty sure the "Table" variable is Dim Table as Recordset but what is the "DB" variable??? Is it Dim DB as Connection????

  2. #2
    Fanatic Member Gaffer's Avatar
    Join Date
    Nov 2000
    Location
    London
    Posts
    828
    Dim db as database

    This is DAO...

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Jul 2001
    Posts
    18

    Angry

    I know that what you are saying should work but for some reason it does not......I keep getting a "User defined type not defined" error when "On_Current" and "On_Load"........I really don't understand what the problem is, it should be exactly what you said.........It works fine if I leave both variables as "Variant" but of course that is bad programming. Thanks for all your help

  4. #4
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    Make sure your reference is set to DAO, and there's not one set for ADO.
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Jul 2001
    Posts
    18

    Thumbs up

    Thanks for all your help....It works now........I added the reference to MS DAO 3.6 Object Library and removed the reference to MS ActiveX Data Objects 2.1 Library.......I am assuming this is correct now that it is working. If it is still wrong please let me know. Thanks again!

  6. #6
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    You doing this with Access 2000 / VBA? I believe it defaults to having the reference for ADO checked, which can cause confusion if you add DAO, because of similar object names. Since you have it working you should be all set.
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

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