E mail out depending on the dates

monplankton

Registered User.
Local time
Today, 15:26
Joined
Sep 14, 2011
Messages
83
Hi ,

Trying to send out some reminder E mails using some dates that I've set up in text boxes but can't get it to work.

I've started out simple to get it working as I'm not familar with VBA

Code:
If Me![Planned Finish] <= [2days] And Me![Final Reminder] Is Null Then
MsgBox "YES", vbOKOnly

Keeps saying object required, any help much appreciated. Oh working in 2003. Thanks
 
Is [2days] a control in the form then you are missing the Me in front of it -
Code:
Me.[2days]
 
Hi JHB,

Thanks for the reply. I very rarely use VBA but this is what I have now and using your advise I have added me. to the control and yes it is a field on a form, but it still gives me the same error!


If Me.Planned_Finish <= Me.[2days] And Me.[Final Reminder] Is Null Then
ElseIf Me.Planned_Finish <> "none" Then
End If

Dim objOutlook As Outlook.Application, objMailItem As MailItem
Set objOutlook = New Outlook.Application
Set objMailItem = objOutlook.CreateItem(olMailItem)
With objMailItem
.to = Me![FirstName] & "." & [LastName] & "@nissan-nmuuk.co.uk"
.cc = "graham.atkins@uwclub.net"
.Subject = "24 Hour Reminder"
.Body = "Hi" & [FirstName] & ", As mentioned in previous e-mail correspondence, PQA Inspection have yet to receive a formal rework extension request for" & " " & [Part Description] & "," & " " & [Rework Activity] & " " & "reworks order number" & " " & [WO Number] & " " & ", RCS Number" & " " & [RCS Number] & " " & "which is now 24hrs from expiry.If the rework is to continue then an extension request must be received within the next 24hrs. Failure to comply with this notification will result in the termination of the rework activity and the removal of the resource performing the operation tomorrow."
.Send
End With

Set objMailItem = Nothing
Set objOutlook = Nothing

Me.[Final Reminder] = Now()
 
In VBA,

something IS NULL tests for objects

It should be

If IsNull(SomeVariableOrControl) Then
 
Not sure I fully undersand what you mean!

If Date = Me.Threeweeks Then

Dim objOutlook As Outlook.Application, objMailItem As MailItem
Set objOutlook = New Outlook.Application
Set objMailItem = objOutlook.CreateItem(olMailItem)
With objMailItem
.to = Me.LastName & ", " & Me.FirstName
.cc = "graham.atkins@uwclub.co.uk"
.Subject = "3 week Reminder"
.Body = "Hi " & [FirstName] & "," & vbCrLf & "You currently have an ongoing rework on the Rework Management System." & " " & [Part Description] & "," & " " & [Rework Activity] & " " & "reworks order number" & " " & [WO Number] & " " & ", RCS Number" & " " & [RCS Number] & vbCrLf & "This rework is due to expire in 3 weeks time on " & [Planned Finish] & ". As you are aware, if the rework is to continue then a rework extension request should be raised and approved. Can you please ensure a rework extension request is raised and approved prior to this date." & vbCrLf & "Regards" & vbCrLf & "PQA Admin"
.Send
End With

Set objMailItem = Nothing
Set objOutlook = Nothing

Me.[FirstReminder] = Date

I have this working fine now but I still want to stop it E mailing out if the [FirstReminder] has a date in. Can you show me how I could do this? Everything I've tried it just ignores.
 

Users who are viewing this thread

Back
Top Bottom