Results 1 to 3 of 3
  1. #1
    SorenIX's Avatar
    SorenIX is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jun 2011
    Posts
    15

    If table exists then

    Hi,



    I want to check if a table exists and check a certain checkbox if it does with VB. I went on other forums looking arround for the same question, but there's too many things I don't know about the codes...

    I would like some explaination on the code, how to apply it and the code itself.

    Thanks for your help!
    Last edited by SorenIX; 06-26-2011 at 08:52 AM.

  2. #2
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    some ways to check are:

    Code:
    if currentdb.tabledefs("table name").name = "" then
       'table does not exist
    but the most common way to do it is to catch the object error:

    Code:
    on error resume next
    dim var
    var = currentdb.tabledefs("table name").name
       if err.number <> 0 then
          'table does not exist

  3. #3
    SorenIX's Avatar
    SorenIX is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jun 2011
    Posts
    15
    EDIT :

    Nvm, I got it to work perfectly! ^^

    Thanks a lot!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Testing if a record exists on a Table
    By axess_nab in forum Queries
    Replies: 2
    Last Post: 06-14-2011, 12:27 PM
  2. How to test of record exists in table?
    By tdaccess in forum Access
    Replies: 3
    Last Post: 04-13-2011, 10:22 AM
  3. SQL - find out whether a table exists
    By yurako in forum Programming
    Replies: 2
    Last Post: 01-20-2010, 09:27 AM
  4. Replies: 1
    Last Post: 11-30-2009, 05:05 AM
  5. Create Table If Not Exists
    By jp2access in forum Queries
    Replies: 7
    Last Post: 07-14-2009, 12:49 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
  •  
Other Forums: Microsoft Office Forums