S
steve
I have the following code.
Public Function fTableExists1(strTableName As String) As Boolean
Dim db As Database
Dim tdf As Tabledef
Set db = DBEngine(0)(0)
fTableExists1 = False
For Each tdf In db.TableDefs
If tdf.Name = strTableName Then fTableExists1 = True
Next tdf
Set db = Nothing
End Function
I have a file called "Atable".
When I put
debug.Print y = fTableExists1("Atable")
Into the Immediate windows I get False.
When I put
?fTableExists1("Atable")
Into the immediate window I get True.
When I rename the table to something else I get the exact same answers
as above.
Can anyone tell me why I dont get the answers that I think I should
get ?? That is True when the table exists and false when it does not.
Regards
Public Function fTableExists1(strTableName As String) As Boolean
Dim db As Database
Dim tdf As Tabledef
Set db = DBEngine(0)(0)
fTableExists1 = False
For Each tdf In db.TableDefs
If tdf.Name = strTableName Then fTableExists1 = True
Next tdf
Set db = Nothing
End Function
I have a file called "Atable".
When I put
debug.Print y = fTableExists1("Atable")
Into the Immediate windows I get False.
When I put
?fTableExists1("Atable")
Into the immediate window I get True.
When I rename the table to something else I get the exact same answers
as above.
Can anyone tell me why I dont get the answers that I think I should
get ?? That is True when the table exists and false when it does not.
Regards