Do not show an empty table

M

margaret

I'm going to use an unmatched query in a macro and if the two tables match, I
don't want an empty table to open. How would I "program" the unmatched query
so that it only opens if there are records?
 
O

Ofer Cohen

Use code for that, create a function in a module

Function NewFunctionName()

If Dcount("*","QueryName") > 0 Then
docmd.OpenQuery "QueryName"
End If

End Function
=====================
If you still want to use a macro, create one that calls the above function.
 
M

margaret

Thanks, I got that to work

Ofer Cohen said:
Use code for that, create a function in a module

Function NewFunctionName()

If Dcount("*","QueryName") > 0 Then
docmd.OpenQuery "QueryName"
End If

End Function
=====================
If you still want to use a macro, create one that calls the above function.
 
Top