Phil4tektips
Technical User
I have the following code. Which will email out when a record is overdue. It works at the moment if the record is 3 days overdue...hence the If statement:
If (![Days Overdue] = 3) Then
Ideally the condition should be a range of 1-14. I've tried but I cant get the syntax right?! Any help would be much appreciated.
Code:
Private Sub Form_Open(Cancel As Integer)
Dim dbs As DAO.Database, rst As DAO.Recordset
Dim strEmail As String
Dim strDate As String
Set dbs = CurrentDb()
Set rst = dbs.OpenRecordset("qryEmailForResponse")
strEmail = "zzzzz@xxxxx.co.uk"
strDate = date
With rst
While Not .EOF
If (![Days Overdue] = 3) Then
DoCmd.SendObject , , , strEmail, , , "QRQ Reminder - " & " " & "" & strDate & "", "This is an automated email direct from the QRQ Database." & vbCrLf & vbCrLf & "Please respond." & vbCrLf & vbCrLf & "- Thankyou."
End If
.MoveNext
Wend
End With
Set rst = Nothing: Set dbs = Nothing
End Sub
~Phil4tektips~
Grant us peace in our days work!
If (![Days Overdue] = 3) Then
Ideally the condition should be a range of 1-14. I've tried but I cant get the syntax right?! Any help would be much appreciated.
Code:
Private Sub Form_Open(Cancel As Integer)
Dim dbs As DAO.Database, rst As DAO.Recordset
Dim strEmail As String
Dim strDate As String
Set dbs = CurrentDb()
Set rst = dbs.OpenRecordset("qryEmailForResponse")
strEmail = "zzzzz@xxxxx.co.uk"
strDate = date
With rst
While Not .EOF
If (![Days Overdue] = 3) Then
DoCmd.SendObject , , , strEmail, , , "QRQ Reminder - " & " " & "" & strDate & "", "This is an automated email direct from the QRQ Database." & vbCrLf & vbCrLf & "Please respond." & vbCrLf & vbCrLf & "- Thankyou."
End If
.MoveNext
Wend
End With
Set rst = Nothing: Set dbs = Nothing
End Sub
~Phil4tektips~
Grant us peace in our days work!