G
Guest
Hello,
I use the following code to determine if tblTable exists before using it later. But the code is not enough because the table could be empty. How do I check if the tblTable has no data? Or is empty? Contains no records? Thanks,
RichardA
Dim dbs As Database
Dim tdf As TableDef
Dim blnTableExists As Boolean
'Determine if a table exists.
blnTblExists = False
Set dbs = CurrentDb()
For Each tdf In dbs.TableDefs
If tdf.Name = "tblTable" Then blnTableExists = True
Next tdf
If (blnTableExists = False) Then 'Do not access tblTable
GoTo 10
End If
I use the following code to determine if tblTable exists before using it later. But the code is not enough because the table could be empty. How do I check if the tblTable has no data? Or is empty? Contains no records? Thanks,
RichardA
Dim dbs As Database
Dim tdf As TableDef
Dim blnTableExists As Boolean
'Determine if a table exists.
blnTblExists = False
Set dbs = CurrentDb()
For Each tdf In dbs.TableDefs
If tdf.Name = "tblTable" Then blnTableExists = True
Next tdf
If (blnTableExists = False) Then 'Do not access tblTable
GoTo 10
End If