Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Should be simple: incompatible types

Should be simple: incompatible types

Scheduled Pinned Locked Moved Visual Basic
databasehelpquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    AndreFratelli
    wrote on last edited by
    #1

    Hi everyone, I have this declaration:

    Sub CreateTablePessoas(db As Database)
    ' Some code here
    End Sub

    And then this:

    Sub CreateMyForm()
    Dim db As Database
    Dim tdf As TableDef

    Set db = CurrentDb()
    Set tdf = GetTable("Pessoas", db)
    
    If tdf Is Nothing Then
        CreateTablePessoas (db)
    End If
    

    End Sub

    But when calling CreateTablePessoas(db) I get error 13: incompatible types (I'm translating the error message from portuguese, so I'm not sure that's how it would display in english). I'm not much of a VBA guy, so what's the problem here? Thanks in advance.

    Fratelli

    A 1 Reply Last reply
    0
    • A AndreFratelli

      Hi everyone, I have this declaration:

      Sub CreateTablePessoas(db As Database)
      ' Some code here
      End Sub

      And then this:

      Sub CreateMyForm()
      Dim db As Database
      Dim tdf As TableDef

      Set db = CurrentDb()
      Set tdf = GetTable("Pessoas", db)
      
      If tdf Is Nothing Then
          CreateTablePessoas (db)
      End If
      

      End Sub

      But when calling CreateTablePessoas(db) I get error 13: incompatible types (I'm translating the error message from portuguese, so I'm not sure that's how it would display in english). I'm not much of a VBA guy, so what's the problem here? Thanks in advance.

      Fratelli

      A Offline
      A Offline
      AndreFratelli
      wrote on last edited by
      #2

      Got it:

      Call CreateTablelPessoas(db)

      Fratelli

      G 1 Reply Last reply
      0
      • A AndreFratelli

        Got it:

        Call CreateTablelPessoas(db)

        Fratelli

        G Offline
        G Offline
        GuyThiebaut
        wrote on last edited by
        #3

        If you take out the brackets(parentheses) you should be able to manage without the Call as in:

        CreateTablelPessoas db

        This one always used to catch me out too...

        “That which can be asserted without evidence, can be dismissed without evidence.”

        ― Christopher Hitchens

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups