B
BrianDP
I'm hoping someone can help me with an Exists() function.. I want to
know if tables, queries, or reports - and I'm not really even going to
ask about tables.. Just queries and reports.. But I thought this could
be all inclusive, if you ask it about a table, it could return a good
yes or no to that as well.. Here is my first stab that doesn't seem
to work right no matter what I do!
Public Function eXists(objectName As String) As Boolean
Dim db As Database
Dim rst As Recordset
Set db = CurrentDb()
Set rst = db.OpenRecordset("select * from [msysobjects] where
[msysobjects].[name] = """ & objectName & """")
If rst.NoMatch Then
eXists = False
Else
eXists = True
End If
End Function
PS. I apologize if this has been answered before. I glanced on the
web search, and I looked again in Groups, and didn't find the answer.
I Aplogize in advance if I"ve ruffled any feathers with this queriy.
know if tables, queries, or reports - and I'm not really even going to
ask about tables.. Just queries and reports.. But I thought this could
be all inclusive, if you ask it about a table, it could return a good
yes or no to that as well.. Here is my first stab that doesn't seem
to work right no matter what I do!
Public Function eXists(objectName As String) As Boolean
Dim db As Database
Dim rst As Recordset
Set db = CurrentDb()
Set rst = db.OpenRecordset("select * from [msysobjects] where
[msysobjects].[name] = """ & objectName & """")
If rst.NoMatch Then
eXists = False
Else
eXists = True
End If
End Function
PS. I apologize if this has been answered before. I glanced on the
web search, and I looked again in Groups, and didn't find the answer.
I Aplogize in advance if I"ve ruffled any feathers with this queriy.