Hi friends, i am new to vba macros. Any idea to check the table if it is exists or not? I check with previous post and idea, but not got clear solution for this. Please provide your idea.
Thanks in Advance Friends.
Hi friends, i am new to vba macros. Any idea to check the table if it is exists or not? I check with previous post and idea, but not got clear solution for this. Please provide your idea.
Thanks in Advance Friends.
Access has some sort of system tables You can read about it a little here you can fire the folowing query to see if it exists ( 1 = it exists, 0 = it doesnt ;))
SELECT Count([MSysObjects].[Name]) AS [Count]
FROM MSysObjects
WHERE (((MSysObjects.Name)="TblObject") AND ((MSysObjects.Type)=1));
This is not a new question. I addresed it in comments in one SO post, and posted my alternative implementations in another post. The comments in the first post actually elucidate the performance differences between the different implementations.
Basically, which works fastest depends on what database object you use with it.
Finally i search and got the result,
I used this function,
Public Function ifTableExists(tblName As String) As Boolean
ifTableExists = False
If DCount("[Name]", "MSysObjects", "[Name] = '" & tblName & "'") = 1 Then
ifTableExists = True
End If
End Function
I also verified previous post but not got any correct answer. This is worked for me a great. thanks guys for your help and support.
For this one, have to choose the Microsoft Access 12.0 Object Library
. It is in the references
in Menu Bar Tools
.