bakersburg9
Jul 16 2007, 01:47 PM
I have a routine I run every day where I compare two tables, and basically do a find unmatched query, and the results are made into a table via a make table query (actually it's the same query). The results of this table are e-mailed to select individuals via a DoCmd.Send Object.
But I don't want this sent out if there is zero data, and I don't want to incorporate an extra step, for example a report with an on no data =cancel property - I don't want to add an extra step.
Is there a way in code I can cancel the DoCmd if the table has zero records ?
niesz
Jul 16 2007, 01:52 PM
1. I don't think you need to use a Make-Table here. You can send the results of the query directly. Your db should never bloat, either. And you won't have to delete the table every time.
2. You could use a DCount to interrogate how many records the query returns before sending it.
CyberCow
Jul 16 2007, 01:52 PM
Place the following before any other code in your procedure.
If DCcount("[FieldName]","TableName") = 0 Then
Exit Sub '(or function)
End If
hope this helps
bakersburg9
Jul 16 2007, 01:57 PM
Walter, Marc - thanks !!!

Steve
niesz
Jul 16 2007, 01:58 PM
NP.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.