StaRKeY
StaRKeY at Wanadoo.nl
Thu Mar 20 06:52:00 CST 2003
Just out of curiousity Tom, why are you so persistent in using the
msysobjects while we are being offered a pretty easy down to earth Access
objectmodel? (I'm sorry if I came on too strong about the sample)
Eric Starkenburg
-----Original Message-----
From: accessd-admin at databaseadvisors.com
[mailto:accessd-admin at databaseadvisors.com]On Behalf Of t tom
Sent: donderdag 20 maart 2003 01:46
To: accessd at databaseadvisors.com
Subject: Re: [AccessD] Does table exist?
OK , Lets try again ( making code a little less squeaky , now only checks
for tables )
Public Function CheckTableExist(strTableName As String) As Boolean
Dim strCriteria As String
strCriteria = "name = '" & strTableName & "'" & " and type=1"
If Nz(DCount("[ID]", "MSysObjects", strCriteria), 0) > 0 Then
CheckTableExist = True
Else
CheckTableExist = False
End If
End Function
Tomt
----- Original Message -----
From: StaRKeY
To: accessd at databaseadvisors.com
Sent: Wednesday, March 19, 2003 1:27 PM
Subject: RE: [AccessD] Does table exist?
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.
Ill 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.
--------------------------------------------------------------------------
avast! Antivirus: Outbound message clean.
Virus Database (VPS): 19-3-2003
Tested on: 19-3-2003 21:27:40
avast! is copyright (c) 2000-2003 ALWIL Software.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://databaseadvisors.com/pipermail/accessd/attachments/20030320/14b9910a/attachment-0001.html>