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?
 
Anyone at all have any thoughts/advise on this?
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top