J
JNariss
Hello,
I have a form with the following code that is not working properly.
This form is created from one simple table called tblRequestPassword
with all fields being required. Fields are RequestID, Name, Reason, and
Date.
I was hoping someone could take a look and perhaps see what errors are
in my code. What I want it to do is to check that all fields have a
value and if so then execute the SendObject command. However, it is not
executing an error if any of the fields are left blank it just runs the
SendObject.
Private Sub Command9_Click()
On Error GoTo Err_Command9_Click
Dim strTo As String
Dim strRequestID As String
Dim strMessage As String
Dim strYourName As String
Dim strReason As String
strTo = "(e-mail address removed);[email protected]"
strRequestID = Me.RequestID
strYourName = Me.YourName
strReason = Me.Reason
strMessage = "A request for a password is needed to make the following
change. Please view the details below and contact this person with
further instructions." & Chr$(13) & Chr$(13) & _
"Request ID: " & strRequestID & Chr$(13) & Chr$(13) & _
"Name: " & strYourName & Chr$(13) & Chr$(13) & _
"Reason: " & strReason & Chr$(13) & Chr$(13) & _
"Please do not reply to this automated email."
DoCmd.SendObject acSendNoObject, , , strTo, , , "Password needed to
Edit a Request", strMessage, No, False
DoCmd.Close acForm, "frmRequestPassword"
MsgBox "Your request for a password has been sent. You will be
contacted with further instructions.", vbOKOnly, "Password Request
Sent"
Exit_Command9_Click:
Exit Sub
Err_Command9_Click:
MsgBox Err.Description & Chr$(13) & Chr$(13) & _
"Required fields for this form are: Request ID, Date, Name, and
Reason. If all the required fields are not filled in, your form will
not be submitted.", vbOKOnly
Resume Exit_Command9_Click
End Sub
Thank You,
Justine
I have a form with the following code that is not working properly.
This form is created from one simple table called tblRequestPassword
with all fields being required. Fields are RequestID, Name, Reason, and
Date.
I was hoping someone could take a look and perhaps see what errors are
in my code. What I want it to do is to check that all fields have a
value and if so then execute the SendObject command. However, it is not
executing an error if any of the fields are left blank it just runs the
SendObject.
Private Sub Command9_Click()
On Error GoTo Err_Command9_Click
Dim strTo As String
Dim strRequestID As String
Dim strMessage As String
Dim strYourName As String
Dim strReason As String
strTo = "(e-mail address removed);[email protected]"
strRequestID = Me.RequestID
strYourName = Me.YourName
strReason = Me.Reason
strMessage = "A request for a password is needed to make the following
change. Please view the details below and contact this person with
further instructions." & Chr$(13) & Chr$(13) & _
"Request ID: " & strRequestID & Chr$(13) & Chr$(13) & _
"Name: " & strYourName & Chr$(13) & Chr$(13) & _
"Reason: " & strReason & Chr$(13) & Chr$(13) & _
"Please do not reply to this automated email."
DoCmd.SendObject acSendNoObject, , , strTo, , , "Password needed to
Edit a Request", strMessage, No, False
DoCmd.Close acForm, "frmRequestPassword"
MsgBox "Your request for a password has been sent. You will be
contacted with further instructions.", vbOKOnly, "Password Request
Sent"
Exit_Command9_Click:
Exit Sub
Err_Command9_Click:
MsgBox Err.Description & Chr$(13) & Chr$(13) & _
"Required fields for this form are: Request ID, Date, Name, and
Reason. If all the required fields are not filled in, your form will
not be submitted.", vbOKOnly
Resume Exit_Command9_Click
End Sub
Thank You,
Justine