[AccessD] Does table exist?

StaRKeY StaRKeY at Wanadoo.nl
Wed Mar 19 14:34:00 CST 2003


Lets not(!)...Marc

Fyi this table also contains the names of forms, modules, classes or in
short Access objects... in case the name of a table resembles another object
any object for that matter this code will not work properly. Ofcourse, if
you are sure it's of no importance to you go ahead and use squeeky code:-)
(no offense Tom)
The code would get better if you also use the special ID's used for tables
but then again there are several since you can have hidden/linked/system
tables... all having their own id... easier to just use code mentioned
earlier.

BN

 -----Original Message-----
From: accessd-admin at databaseadvisors.com
[mailto:accessd-admin at databaseadvisors.com]On Behalf Of Mark Boyd
Sent: woensdag 19 maart 2003 21:09
To: accessd at databaseadvisors.com
Subject: RE: [AccessD] Does table exist?


  Thanks Tom.

  I'll give it a try.



  Mark



  -----Original Message-----
  From: t tom [mailto:ttom at accessyourdata.com]
  Sent: Wednesday, March 19, 2003 2:54 PM
  To: accessd at databaseadvisors.com
  Subject: Re: [AccessD] Does table exist?



  Hi



  Try



  Public Function CheckTableExist(strTableName As String) As Boolean
  Dim strCriteria As String



  strCriteria = "name = '" & strTableName & "'"
  If Nz(DCount("[ID]", "MSysObjects", strCriteria), 0) > 0 Then
      CheckTableExist = True
  Else
      CheckTableExist = False
  End If

  End Function



  HTH

  Tomt

    ----- Original Message -----

    From: Mark Boyd

    To: AccessD at databaseadvisors.com

    Sent: Wednesday, March 19, 2003 10:48 AM

    Subject: [AccessD] Does table exist?



    Is there code to find out if an Access table exists in the database?



    TIA,

    Mark Boyd

    Sr. Systems Analyst

    McBee Associates, Inc.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://databaseadvisors.com/pipermail/accessd/attachments/20030319/d10ce746/attachment-0001.html>


More information about the AccessD mailing list