Access 97..
I am trying to write code that will count the number of records in table, but it appears that I'm getting the syntax incorrect as I keep getting a Type Mismatch error. The code is:
Dim d As Database
Dim tdf As TableDef
str_obj_name = "table_data"
Set tdf = d.TableDefs(str_obj_name)
If tdf.RecordCount > 0 Then
MsgBox "There is at least one record in the table"
Else
MsgBox "There are no records in the table"
End If
Any suggestion as to what I'm doing wrong is appreciated..
I am trying to write code that will count the number of records in table, but it appears that I'm getting the syntax incorrect as I keep getting a Type Mismatch error. The code is:
Dim d As Database
Dim tdf As TableDef
str_obj_name = "table_data"
Set tdf = d.TableDefs(str_obj_name)
If tdf.RecordCount > 0 Then
MsgBox "There is at least one record in the table"
Else
MsgBox "There are no records in the table"
End If
Any suggestion as to what I'm doing wrong is appreciated..