expression to check if table is empty

  • Thread starter Thread starter Jason Morin
  • Start date Start date
J

Jason Morin

Hello, using Access 2002/WinXP.
I have button on a form that allows the user to move to
the next form, but the button runs a macro that checks
several things (such as checking for the existence of a
file on the user's PC) before a allowing the user to move
on. If the condition in the macro is not met, I just use
StopMacro and throw up a msgbox with a warning.

Condition Action
Len(Dir("C:\...))<2 Msgbox
.... StopMacro

The one check I'm struggling with is how to check a table
to see if it is empty (no records). Seems simple. I tried:

Condition Action
Sum([region1]![sales])=0 Msgbox
.... StopMacro

But I get the error: "The object doesn't contain the
Automation object "region1".

Any suggestions? Thanks for taking the time to read this.
Jason
 
Use the DCount function:

DCount("*", "TableName") = 0

When above is true, the table has no records.
 
Back
Top