Check if any records in the table

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi
What's the most straightforward approach to check for records in a table?

Basically if the table is empty I want to run a particular action, if it is
not empty then I want to run another action.

Many thanks
 
Use DLookup() on the primary key of the table.
If it returns Null, there's no records.

Example:
If IsNull(DLookup("ID", "Table1")) Then ...
 
Hi
What's the most straightforward approach to check for records in a table?

Basically if the table is empty I want to run a particular action, if it is
not empty then I want to run another action.

Many thanks

If DCount("*","TableName")>0 Then
' Has records
Else
' No records
End If
 
Back
Top