O
Opal
I have an Access 2003 database from which I have automated the
emailing
of a report each Friday the first time the database is opened.
I run the following from the on Timer event when the DB is opened:
If Me.cboDayofWeek = 6 Then ' test to send Friday (weekly)
Management Report
TestSend
End If
Then
Sub TestSend()
If 0 = DCount("*", "qryAudit") Then
SendManagementrpt
End If
End Sub
and the following is the SQL from "qryAudit"
SELECT Audit.AuditDate, Audit.AuditDay, Audit.AuditTime
FROM Audit
WHERE (((Audit.AuditDate)=Date()) AND ((Audit.AuditDay)=6) AND
((Audit.AuditTime)>#12/30/1899 6:0:0# And
(Audit.AuditTime)<#12/30/1899 11:0:0#));
Everything seems to work fine, except, anytime the DB is opened after
midnight
on Friday morning it sends the report. So if its opened 20 times
between midnight
and 2 am on Friday morning, it will send the report 20 times. I
thought by putting
in the time constraints that it would prevent that, but it doesn't. I
can't quite figure
out how to correct this. Can anyone offer any assistance / advice?
emailing
of a report each Friday the first time the database is opened.
I run the following from the on Timer event when the DB is opened:
If Me.cboDayofWeek = 6 Then ' test to send Friday (weekly)
Management Report
TestSend
End If
Then
Sub TestSend()
If 0 = DCount("*", "qryAudit") Then
SendManagementrpt
End If
End Sub
and the following is the SQL from "qryAudit"
SELECT Audit.AuditDate, Audit.AuditDay, Audit.AuditTime
FROM Audit
WHERE (((Audit.AuditDate)=Date()) AND ((Audit.AuditDay)=6) AND
((Audit.AuditTime)>#12/30/1899 6:0:0# And
(Audit.AuditTime)<#12/30/1899 11:0:0#));
Everything seems to work fine, except, anytime the DB is opened after
midnight
on Friday morning it sends the report. So if its opened 20 times
between midnight
and 2 am on Friday morning, it will send the report 20 times. I
thought by putting
in the time constraints that it would prevent that, but it doesn't. I
can't quite figure
out how to correct this. Can anyone offer any assistance / advice?