Re: On Error GoTo is not working
- From: "BruceM" <bamoob@xxxxxxxxxxxxxxxxxx>
- Date: Fri, 3 Mar 2006 14:16:30 -0500
Does it work? Usually you would use Chr(10) & Chr(13) (carriage return and
line feed, in that order) to skip to the next line. Maybe using Chr(13)
twice eliminates the need for Chr(10). No matter. I just wondered about
the unusual syntax. If it works, it works. vbCrLf accomplishes the same
thing in VBA as does Chr(13) & Chr(10), by the way, although you can't use
it in an expression.
<JNariss@xxxxxxxxx> wrote in message
news:1141410421.503842.112990@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Bruce,
The Chr code enters a line in between my code. So when the user
receives an email it will look like this:
Request ID: 500
Name: Betty White
Reason: To read this easier
-------------------------------------------------------------------------------------------------->>>>>
Klatuu,
I tried to the code and had to fix up a couple errors on the messages
boxes. However, I am now getting an error which states:
"with object must be user-defined type, Object, or Variant."
This then ofcourse points to the with " _ line in the code. The code I
am using is:
Private Sub Command9_Click()
Dim strRequestID As String
Dim strTo As String
Dim strHeader As String
Dim strMessage As String
Dim strYourName As String
Dim strReason As String
Dim blnRequiredFieldIsMissing As Boolean
On Error GoTo Err_Command9_Click
If IsNull(Me.RequestID) Then
blnRequiredFieldIsMissing = True
Else
strRequestID = Me.RequestID
End If
If IsNull(Me.YourName) Then
blnRequiredFieldIsMissing = True
Else
strYourName = Me.YourName
End If
If IsNull(Me.Reason) Then
blnRequiredFieldIsMissing = True
Else
strReason = Me.Reason
End If
If blnRequiredFieldIsMissing Then
MsgBox "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
Else
strTo = "justinenariss@xxxxxxxxxxxxx;justine.nariss@xxxxxxxxx"
strHeader = "Password needed to Edit a Request"
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, , , _
strHeader, 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"
End If
Exit_Command9_Click:
Exit Sub
Err_Command9_Click:
MsgBox Err.Description
Resume Exit_Command9_Click
End Sub
If anyone knows how to correct this problem, I would appreciate it.
Thanks,
Justine
.
- Follow-Ups:
- Re: On Error GoTo is not working
- From: JNariss@xxxxxxxxx
- Re: On Error GoTo is not working
- References:
- On Error GoTo is not working
- From: JNariss@xxxxxxxxx
- RE: On Error GoTo is not working
- From: Klatuu
- Re: On Error GoTo is not working
- From: BruceM
- Re: On Error GoTo is not working
- From: JNariss@xxxxxxxxx
- On Error GoTo is not working
- Prev by Date: Re: Filtering
- Next by Date: Re: Calculating Months Between Two Dates
- Previous by thread: Re: On Error GoTo is not working
- Next by thread: Re: On Error GoTo is not working
- Index(es):
Relevant Pages
|
Loading