Re: On Error GoTo is not working



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



.



Relevant Pages

  • Re: On Error GoTo is not working
    ... Dim strRequestID As String ... Dim strMessage As String ... MsgBox "Required fields for this form are: Request ID, Date, Name, ...
    (microsoft.public.access.formscoding)
  • Re: On Error GoTo is not working
    ... Dim strRequestID As String ... Dim strMessage As String ... MsgBox "Required fields for this form are: Request ID, Date, Name, ...
    (microsoft.public.access.formscoding)
  • How can I do a loop?
    ... Dim strBrief_Description As String ... strMessage = "The following requesthave been moved into production: ... "For futher details regarding this request please go to the database ...
    (microsoft.public.access.formscoding)
  • Re: On Error GoTo is not working
    ... Dim strRequestID As String ... Dim blnRequiredFieldIsMissing As Boolean ... MsgBox "Required fields for this form are: Request ID, Date, ...
    (microsoft.public.access.formscoding)
  • Re: Web DAV only works when authenticated to OWA
    ... > Dim objRequest 'As MSXML.XMLHTTPRequest ... > Dim strXMLNSInfo 'As String ... > ' Specify the URL of the new object to be created. ... > ' Put it all together in an HTTP request. ...
    (microsoft.public.exchange.development)

Loading