Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Auto email....If Range(1,14) not working 1

Status
Not open for further replies.

Phil4tektips

Technical User
Joined
Jul 18, 2005
Messages
89
Location
GB
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] >= 1 And ![Days Overdue] <= 14 Then

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top