G
Guest
The function below checks to if a table exists. The
problem is that when the program hits "For each tbl" line
for the first time ito hangs for a long time and then
quicly processes the loop. Is there another way to do this
that would be faster (staying with ADO programming)? Am I
doing something inefficient?
The table are on a server and the code below runs locally.
----------------
Function TableExists(db As ADODB.Connection, strTableName
As String) As Boolean
On Error Resume Next
Dim cat As ADOX.Catalog
Dim tbl As ADOX.Table
Dim Counter As Long
TableExists = False
Set cat = New ADOX.Catalog
cat.ActiveConnection = db
For Each tbl In cat.Tables
If tbl.Name = strTableName Then
TableExists = True
Exit For
End If
Next tbl
End Function
problem is that when the program hits "For each tbl" line
for the first time ito hangs for a long time and then
quicly processes the loop. Is there another way to do this
that would be faster (staying with ADO programming)? Am I
doing something inefficient?
The table are on a server and the code below runs locally.
----------------
Function TableExists(db As ADODB.Connection, strTableName
As String) As Boolean
On Error Resume Next
Dim cat As ADOX.Catalog
Dim tbl As ADOX.Table
Dim Counter As Long
TableExists = False
Set cat = New ADOX.Catalog
cat.ActiveConnection = db
For Each tbl In cat.Tables
If tbl.Name = strTableName Then
TableExists = True
Exit For
End If
Next tbl
End Function