Results 1 to 6 of 6

Thread: [RESOLVED] How to test if table exists

Threaded View

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 2005
    Posts
    163

    Resolved [RESOLVED] How to test if table exists

    Access, VB

    There must be a simpler way to test if a table exists in Access rather than having to loop arround all the objects ... isn't there? My code is:
    VB Code:
    1. Dim catLocal As ADOX.Catalog
    2. Dim tblLinked As ADOX.Table
    3. Dim lintTable As Integer
    4. Dim lblnTable as boolean
    5.  
    6. ' Create a connection to QuoteWerks
    7. Set catLocal = New ADOX.Catalog
    8. catLocal.ActiveConnection = lcnnQW
    9.  
    10. ' Loop arround all the objects
    11. For lintTable = 0 To catLocal.Tables.Count - 1
    12.     If CStr(catLocal.Tables.Item(lintTable).Name) = lstrQWTable Then
    13.         lblnTable = True
    14.         Exit For
    15.     End If
    16. Next ' Table
    (PS I know I posted this as part of another post but did not get a reply ... see How to add ODBC linked table in an Access database where I still have a problem with creating the primary key to a linked table)
    Last edited by chilling; Sep 16th, 2005 at 11:52 AM.
    chilling

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