O
Opal
I am trying to run a query from a VBA module in the OnOpen
event of my main form. Basically, if the day of the week is
a Friday, then the following appears in the OnOpen Event:
If Forms![frmMain]![cboDayofWeek] = 6 Then
qryAudit
End If
Then to:
Function qryAudit()
Dim db As DAO.Database
Dim qd As DAO.QueryDef
Dim strSQL As String
Set db = CurrentDb()
Set qd = db.QueryDefs("qryAudit")
strSQL = qd.SQL
If "Audit.[AuditTime]" < Date And "Audit.[AuditDate]" = Date Then
SendManagementrpt
End If
End Function
the SQL statement for the qryAudit is as follows:
SELECT Audit.AuditDate, Audit.AuditDay, Audit.AuditTime
FROM Audit
WHERE (((Audit.AuditDay)=6));
So Basically, if its Friday and there is no record for today
then send the management report, if there is a record for
today, then don't send the management report.
Can anyone help me sort this out? Thank you.
event of my main form. Basically, if the day of the week is
a Friday, then the following appears in the OnOpen Event:
If Forms![frmMain]![cboDayofWeek] = 6 Then
qryAudit
End If
Then to:
Function qryAudit()
Dim db As DAO.Database
Dim qd As DAO.QueryDef
Dim strSQL As String
Set db = CurrentDb()
Set qd = db.QueryDefs("qryAudit")
strSQL = qd.SQL
If "Audit.[AuditTime]" < Date And "Audit.[AuditDate]" = Date Then
SendManagementrpt
End If
End Function
the SQL statement for the qryAudit is as follows:
SELECT Audit.AuditDate, Audit.AuditDay, Audit.AuditTime
FROM Audit
WHERE (((Audit.AuditDay)=6));
So Basically, if its Friday and there is no record for today
then send the management report, if there is a record for
today, then don't send the management report.
Can anyone help me sort this out? Thank you.