ASCII QUESTION

R

Rpettis31

I am trying to do a carriage return but for some reason it is not working in
my code.

There is no error other than it does not appear on the next line.
subject = "Corrective Action Request " & [CarId] & " has been issued."
.HTMLBody = Me.ItemNumber & ", has the following issue:" & Chr$(10) &
Chr$(13) _
& Me.ProblemDescription & Chr$(10) & Chr$(13) & "Audit Results: " & _
(Char13) & Me.AuditResults & Chr$(13) & Chr$(10) & _
"This issue has been assigned to:" & Me.cmbCarOwner & " for resolution"
 
S

Stuart McCall

Rpettis31 said:
I am trying to do a carriage return but for some reason it is not working
in
my code.

There is no error other than it does not appear on the next line.
subject = "Corrective Action Request " & [CarId] & " has been issued."
.HTMLBody = Me.ItemNumber & ", has the following issue:" & Chr$(10) &
Chr$(13) _
& Me.ProblemDescription & Chr$(10) & Chr$(13) & "Audit Results: " & _
(Char13) & Me.AuditResults & Chr$(13) & Chr$(10) & _
"This issue has been assigned to:" & Me.cmbCarOwner & " for resolution"

Well there are three errors, all to do with using Chr$(13) & Chr$(10). Twice
you have them the wrong way round, and once you refer to it as Char13.

I recommend that you instead use the built-in vb constant vbCrLf:

..HTMLBody = Me.ItemNumber & ", has the following issue:" & vbCrLf _
& Me.ProblemDescription & vbCrLf & "Audit Results: " & _
vbCrLf & Me.AuditResults & vbCrLf & _
"This issue has been assigned to:" & Me.cmbCarOwner & " for resolution"

or (what I would do) :

..HTMLBody = Me.ItemNumber & ", has the following issue:|" _
& Me.ProblemDescription & "|Audit Results: |" & _
Me.AuditResults & _
"|This issue has been assigned to:" & Me.cmbCarOwner & " for resolution"
..HTMLBody = Replace(.HTMLBody, "|", vbCrLf)

You should find that .HTMLBody is the same in both cases, just that the 2nd
method takes less typing and is easier to read (IMO).
 
S

Stuart McCall

Stuart McCall said:
Rpettis31 said:
I am trying to do a carriage return but for some reason it is not working
in
my code.

There is no error other than it does not appear on the next line.
subject = "Corrective Action Request " & [CarId] & " has been issued."
.HTMLBody = Me.ItemNumber & ", has the following issue:" & Chr$(10) &
Chr$(13) _
& Me.ProblemDescription & Chr$(10) & Chr$(13) & "Audit Results: " & _
(Char13) & Me.AuditResults & Chr$(13) & Chr$(10) & _
"This issue has been assigned to:" & Me.cmbCarOwner & " for
resolution"

Well there are three errors, all to do with using Chr$(13) & Chr$(10).
Twice you have them the wrong way round, and once you refer to it as
Char13.

I recommend that you instead use the built-in vb constant vbCrLf:

.HTMLBody = Me.ItemNumber & ", has the following issue:" & vbCrLf _
& Me.ProblemDescription & vbCrLf & "Audit Results: " & _
vbCrLf & Me.AuditResults & vbCrLf & _
"This issue has been assigned to:" & Me.cmbCarOwner & " for resolution"

or (what I would do) :

.HTMLBody = Me.ItemNumber & ", has the following issue:|" _
& Me.ProblemDescription & "|Audit Results: |" & _
Me.AuditResults & _
"|This issue has been assigned to:" & Me.cmbCarOwner & " for resolution"
.HTMLBody = Replace(.HTMLBody, "|", vbCrLf)

You should find that .HTMLBody is the same in both cases, just that the
2nd method takes less typing and is easier to read (IMO).

I just noticed that you're assigning the string to the .HTMLBody property,
so that ought to be:

..HTMLBody = Me.ItemNumber & ", has the following issue:" & "<br/>" _
& Me.ProblemDescription & "<br/>" & "Audit Results: " & _
"<br/>" & Me.AuditResults & "<br/>" & _
"This issue has been assigned to:" & Me.cmbCarOwner & " for resolution"

or:

..HTMLBody = Me.ItemNumber & ", has the following issue:|" _
& Me.ProblemDescription & "|Audit Results: |" & _
Me.AuditResults & _
"|This issue has been assigned to:" & Me.cmbCarOwner & " for resolution"
..HTMLBody = Replace(.HTMLBody, "|", "<br/>")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top