Hallo,
This code I wrote checks for a query, but you could easily adapt it:
Function ysnQueryExists(ByVal pstrQueryName As String) As Boolean
On Error GoTo Err_ysnQueryExists
' Comments : Determines if the named query exists
' Parameters: pstrQueryName - name of query to check
' Returns : True if named query exists, false otherwise
' : also returns false if pstrQueryName is an empty string
'
If Len(pstrQueryName) = 0 Then GoTo Err_ysnQueryExists
If Len(CurrentDb.QueryDefs(pstrQueryName).name) = 0 Then GoTo Err_ysnQueryExists
ysnQueryExists = True
Exit_ysnQueryExists:
Exit Function
Err_ysnQueryExists:
ysnQueryExists = False
Resume Exit_ysnQueryExists
End Function
- Frink