Reputation: 347
Im working on a form that sends an email on the click of a command button, but after the email is made the text boxes the user must fill in do not automatically clear out. I have provided the code I have below. Is there some other kind of clearing command I am missing maybe?
Thanks in advance :)
On Error GoTo errhandle
Me.Filter = "CurrentDate= #" & Format(Me!CurrentDate, "yyyy\-mm\-dd") & "# and DiscoverTime= '" & Me!DiscoverTime & "' and TailNumber= '" & Me!TailNumber & "' and FleetID= '" & Me!FleetID & "'"
Me.FilterOn = True
DoCmd.SendObject acSendForm, "frmETIC", acFormatPDF, "email", "", "", "Recovery Report", "Attached is the submitted Recovery Report"
exiterr:
Exit Sub
errhandle:
If Err.Number <> 2501 Then
MsgBox ("Email cancelled!")
End If
Resume exiterr
Me.CurrentDate = Null
Me.DiscoverTime = Null
Me.TailNumber = Null
Me.FleetID = Null
Upvotes: 0
Views: 47
Reputation: 5809
You are exiting the Sub before clearing. Try the following.
On Error GoTo errhandle
Me.Filter = "CurrentDate= #" & Format(Me!CurrentDate, "yyyy\-mm\-dd") & "# and DiscoverTime= '" & Me!DiscoverTime & "' and TailNumber= '" & Me!TailNumber & "' and FleetID= '" & Me!FleetID & "'"
Me.FilterOn = True
DoCmd.SendObject acSendForm, "frmETIC", acFormatPDF, "email", "", "", "Recovery Report", "Attached is the submitted Recovery Report"
Me.CurrentDate = vbNullString
Me.DiscoverTime = vbNullString
Me.TailNumber = vbNullString
Me.FleetID = vbNullString
exiterr:
Exit Sub
errhandle:
If Err.Number <> 2501 Then
MsgBox ("Email cancelled!")
End If
Resume exiterr
Upvotes: 3