It is currently Mon Sep 06, 2010 7:02 am




Post new topic Reply to topic  [ 1 post ] 
 ACCESS - VBA Function - Does a table exists 
Author Message
Site Admin

Joined: Fri May 29, 2009 10:41 am
Posts: 25
Location: Milton Keynes, UK
Post ACCESS - VBA Function - Does a table exists
Paste this into your module.
Code:
Function table_exists(tablename)
found = False
For Each Item In CurrentDb.TableDefs
    If Item.Name = tablename Then
        found = True
        Exit For
    End If
Next

table_exists = found
End Function


Then execute like this
Code:
Sub test()
If table_exists("tblchests") Then MsgBox "it works"
End Sub

_________________
Damo


Tue Jul 13, 2010 11:35 am
Profile WWW
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © phpBB Group.
Designed by Vjacheslav Trushkin for Free Forums/DivisionCore.