Need macro to stop if table is empty

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

Guest

Hello,
I have a query that makes a table of tickets not assigned to our
technicians. If the table has tickets in it, I want the macro to launch a
program, which I think I can do. The problem I have is if the table is empty
the program still trys to assign and logs that it did assign. I need help.
What I would like to do is have some code that checks to see if the table is
empty, if it is I want it to stop there, if has a count >1 then I would like
for it to launch a macro. Anybody have any idea how I should code this?
Thanks.
 
Try the DCount function.

If DCount("*", "[MyTable]") > 0 Then
'Run Program Here
End If
 
Brent,

If you are doing the work through a macro, then insert a StopMacro
action at the very top, with condition:

DCount("*","TableName") >= 1

so the macro will abort if no record is found in the table.

HTH,
Nikos
 
Brent,

In your macro design window, if you do not see a Condition column, then
select Conditions from the View menu.

If you are going to apply Nikos's isea, of using a StopMacro action, I
think the Condition would be...
DCount("*","TableName")=0
 
Back
Top