test for empty table

C

Cheryl

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
 
B

Bruce M. Thompson

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top