UtterAccess HomeUtterAccess Wiki

Welcome Guest ( Log In | Register )

Custom Search
Edit Discussion
> IsTable    

Many times it becomes neccessary to see if a Table object exists in your code. This simple function provides that functionality. As an FYI, in the code you will see the criteria of "[Type] In (1,4,6)". Those values break down to this:

1: Local table.
4: Linked table to an ODBC source.
6: Linked table to a Jet/ACE (Access) source, Sharepoint list, CSV, Excel ... Basically non-ODBC linked tables.

CODE

' Code courtesy of UtterAccess Wiki
' http://www.utteraccess.com/wiki/index.php/Category:FunctionLibrary
' Original submission by: Brent Spaulding (datAdrenaline)
' Date contributed: 2010-07-27
'
' You are free to use it in any application,
' provided this copyright notice is left unchanged.
'

Public Function IsTable(strTableName As String) As Boolean
'Returns a Boolean indicating if the passed string is a table
'in the current database.

   IsTable = DCount("*", "MSysObjects", "[Name]='" & strTableName & "' And [Type] In (1,4,6)")

End Function

Creative Commons License
IsTable by UtterAccess Wiki is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Editing and revision of the content is freely encouraged; for details, see Expected Usage.

Edit Discussion
Custom Search
Thank you for your support!
This page has been accessed 7,719 times.  This page was last modified 09:38, 6 April 2011 by Jack Leach. Contributions by Brent Spaulding  Disclaimers