Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Function crashes Access2000 - don't know why?

Status
Not open for further replies.

tsosiel

Programmer
Aug 10, 2001
42
US
Greetings.
I'm new to ADO and I'm trying to implement the following function which will determine if TName exists as a table. The function crashes in one of my database; works well in all others!! Does anyone have a clue/idea/comment to my problem? I've tried creating a new db and importing 'everything' to the new file - still crashes! I've re-written this code many times - still crashes!! i'm at my wit's end on this!!


Public Function isTable(TName As String) As Boolean
On Error Resume Next
'-------------------------------------------------------------------------------------------------
' Input: table Name
' Output: true if table exists, false if table does not exist
'-------------------------------------------------------------------------------------------------
Dim test As String
Dim cat As New ADOX.Catalog
Const NAME_NOT_IN_COLLECTION = 3265

cat.ActiveConnection = CurrentProject.Connection

test = cat.Tables(TName).Name
If Err.Number <> NAME_NOT_IN_COLLECTION Then
isTableQuery = True
Else
isTableQuery = False
End If

End Function

Thank you in advance.
- Lorentz
 
Check the Library References on the PC that is working correctly and make sure that the same are checked for the one that is not. I am betting that there is a Library Reference missing. Bob Scriver
 
Thanks for the assistance Bob. But I figured this problem out a couple of days ago; I forgot to up date this thread! Basically, I was trying to run a query on a table that didn't exist AND verify that the table existed... normally, Access would return an error... but not so for Make-table queries!

- Lorentz
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top