Run Query/Email Table

  • Thread starter Thread starter Jackson via AccessMonster.com
  • Start date Start date
J

Jackson via AccessMonster.com

Hi,

I've done this in a macro and then saved it as a module. Basically I've got a
query that prompts you to enter a date for it's criteria. My Macro it
SendObject for this query to a mailing list. However, if there are no records
for the date entered I do not want the email to be sent.

How would I go about doing this? In VBA or at query level?
 
Also, is it possible to have the date the user enters when the query runs to
be included in the subject line of the email that will be sent?
 
I would check the record count in VBA and exit the sub if the record count was zero.

Without seeing your code, it is really impossible to give you a detailed reply.

It could be something as simple as using the DCount Function against your table

IF DCount("*","YourTable","SomeDateField = #" & YourDateValue & "#") = 0 THEN
Exit Sub '(or Exit function)
ELSE
'RUN your current code here
END IF
 
Back
Top