test for empty table

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

Guest

In Access 2000 is there a quick way to test if multiple tables are empty. When a form loads I want to test if two tables are empty, if either or both of them still have data I want to disable the Import button and enable the Purge button, vice versa if both tables have data. I'm fine with the enable/disable, just need to know how to test for empty tables. Thanks
 
In Access 2000 is there a quick way to test if multiple tables are empty.
When a form loads I want to test if two tables are empty, if either or both of
them still have data I want to disable the Import button and enable the Purge
button, vice versa if both tables have data. I'm fine with the enable/disable,
just need to know how to test for empty tables.
You can use the "DCount()" function to get a count of the records in a table:

If DCount("*","MyTableName") Then ' >= 1 record

Or check the recordcount of the tabledef:

If CurrentDb.TableDefs("Orders").RecordCount Then ' >= 1 record
 
Back
Top