[AccessD] Modifying a query

Charlotte Foust cfoust at infostatsystems.com
Thu Jun 8 10:41:55 CDT 2006


 Here's another way of testing:

Public Function TestObjExists(ByVal strObjName As String, _
                              ByVal strContainerName As String) As
Boolean
  'created by Charlotte Foust 3/5/2001
  'attempts to set an object variable
  'to determine if the object exists
  Dim dbs As DAO.Database
  Dim obj As Object

  On Error Resume Next
  Set dbs = CurrentDb
  Set obj = dbs.Containers(strContainerName).Documents(strObjName)
  If Err = 3265 Then
    TestObjExists = False
  Else
    TestObjExists = True
  End If
  'cleanup and exit
  Set obj = Nothing
  Set dbs = Nothing
End Function


Charlotte

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin
- Beach Access Software
Sent: Thursday, June 08, 2006 7:54 AM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Modifying a query

Jim:

That's going to be a really handy piece of code.

Would there be a downside, however, to using

On Error Resume Next
(Delete Object)
On Error GoTo 0

I've done that before but it seem s bit like working without a net. 

Rocky





More information about the AccessD mailing list