Results 1 to 4 of 4

Thread: Compile error in VBA for Access- User defined type not defined

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2005
    Posts
    2

    Resolved Compile error in VBA for Access- User defined type not defined

    Hi I'm new to VBA and I'm just trying to create a connection object to the database and also a recordset object in order to add new records to the database. I am directly connected to the database and everytime I compile the following piece of code which is inside a Module it gives me a compile error for Dim dbCurrent As Database and dbMichael As Database. How do I get rid of it. Here is the code:

    Option Compare Database
    Option Explicit
    Function AddPlayer()


    Dim dbCurrent As Database
    Dim rstPlayers As Recordset
    Dim rstCards As Recordset
    Dim dbMichael As Database


    Set dbCurrent = DBEngine.Workspaces(0).Databases(0)

    'This will create a table-type recordset.
    Set rstPlayers = dbMichael.OpenRecordset("Players", "databases\Michael.mdb", DB_OPEN_DYNASET)
    'These will create a dynaset-type recordset.
    Set rstCards = dbMichael.OpenRecordset("Cards", "databases\Michael.mdb", DB_OPEN_DYNASET)

    rstPlayers.Move 4


    End Function


    Hopefully somebody can help- thanks in advance
    Last edited by catastrophic; Jan 12th, 2005 at 12:02 PM.

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