Compile error (info type not defined)

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • john

    #1

    Compile error (info type not defined)

    I'm trying to use the code below. But when the code is run I get:
    Compile error: an infotype defined by user is not defined. <dbClient As
    Databaseis then highlighted.
    Somebody an idea on how do I make this work?
    Thanks,
    john


    Private Sub CheckExists(str TableName As String)
    ' check to see if the table exists, if it does then delete it since the next
    step
    ' in the process is to run a MakeTable query

    Dim dbClient As Database
    Dim tdf As TableDef
    Set dbClient = CurrentDb

    For Each tdf In dbClient.TableD efs
    If tdf.Name = strTableName Then
    DoCmd.DeleteObj ect acTable, trTableName
    Exit Sub
    End If
    Next

    End Sub

    The method is called by:
    Private Sub CheckExists("My Table")


  • RoyVidar

    #2
    Re: Compile error (info type not defined)

    "john" <john@test.comw rote in message
    <MdqdnbGEnPbY74 vYnZ2dnUVZ8tSdn Z2d@casema.nl>:
    I'm trying to use the code below. But when the code is run I get:
    Compile error: an infotype defined by user is not defined. <dbClient
    As Databaseis then highlighted.
    Somebody an idea on how do I make this work?
    Thanks,
    john
    >
    >
    Private Sub CheckExists(str TableName As String)
    ' check to see if the table exists, if it does then delete it since
    the next step
    ' in the process is to run a MakeTable query
    >
    Dim dbClient As Database
    Dim tdf As TableDef
    Set dbClient = CurrentDb
    >
    For Each tdf In dbClient.TableD efs
    If tdf.Name = strTableName Then
    DoCmd.DeleteObj ect acTable, trTableName
    Exit Sub
    End If
    Next
    >
    End Sub
    >
    The method is called by:
    Private Sub CheckExists("My Table")
    Try setting a reference to Microsoft DAO 3.6 Object Library (in
    VBE - Tools | References)

    Also, I'd recommend disambiguating your declarations.

    Dim dbClient As DAO.Database
    Dim tdf As DAO.TableDef

    Some of the DAO objects, properties and methods, share the same
    *name* as objects, properties and methods of other libraries (ADO),
    but they are different, which will/may give RT 13 Type Mismatch
    later on.

    --
    Roy-Vidar


    Comment

    • john

      #3
      Re: Compile error (info type not defined)

      "RoyVidar" <roy_vidarNOSPA M@yahoo.noschre ef in bericht
      >Private Sub CheckExists("My Table")
      >
      Try setting a reference to Microsoft DAO 3.6 Object Library (in
      VBE - Tools | References)
      >
      Also, I'd recommend disambiguating your declarations.
      >
      Dim dbClient As DAO.Database
      Dim tdf As DAO.TableDef
      >
      Some of the DAO objects, properties and methods, share the same
      *name* as objects, properties and methods of other libraries (ADO),
      but they are different, which will/may give RT 13 Type Mismatch
      later on.
      I did set the DAO reference in another mdb and I thought it was an overall
      Access setting. Now I see, it isn't. Setting the reference did the trick!
      Thanks,
      john


      Comment

      Working...