Report Output

mlr0911

Registered User.
Local time
Today, 13:33
Joined
Oct 27, 2006
Messages
155
Hello

Is there a way in VB to have a report NOT output if it's blank? I've tried using:
dlookup and writing a SQl statement in my code before docmd.output but nothing is working. I've been searching the internet but nothing I've tried lets me check to see if any records exsist in a table before moving on. What I was trying to do is

varX = Dlookup("[expr1]", "tbl_DEPOSIT_Output")
If varX = "" Then
'Do nothing
Else
Docmd.outputto acoutputreport.

Hopefully someone can help.

Thanks.
 
You don't use DLookup, you use DCount:

Code:
If DCount("*", "tbl_DEPOSIT_Output") > 0 Then
   DoCmd.OutputTo ....etc.
End If
 
Ah...makes sense...thanks for your help Bob.
 

Users who are viewing this thread

Back
Top Bottom