VbCrLf Or Chr$(13)?

Jun 14, 2005

I have a Send button on my Access form, and in its Event Procedure i have the following:


stText = "You have a new Task" & Chr$(13) & Chr$(13) & _
"Number: " & stCOFNumber & Chr$(13) & _
"ID: " & stCompanyID & Chr$(13) & _
"Name: " & stCompanyName & Chr$(13) & _
"Name: " & stContactName & Chr$(13) & _
"Address: " & stAddress & Chr$(13) & _
"Terms: " & stTRDW & Chr$(13) & _
"Pre-Requisites: " & stPreReq & Chr$(13) & _
"Location of Work: " & stWorkLoc & Chr$(13) & _
"Activities: " & stDelivActiv & Chr$(13) & _
"Start Date: " & stStartDate & Chr$(13) & _
"End Date: " & stEndDate & Chr$(13) & _
"Please reply to confirm Task"

This is supposed to be the text part of the SendObject command.

Now in my outlook textbox, im getting:

You have a new taskNumber: 123456ID:Name: Commercial Bank Name: john johnAddress: Damascudffdfd
Yousef El Azmi
Commercial Bannk Terms: iiiiiiiiiiiiiPre-Requisites: iiiiiiiiiiiiiiLocation: iiiiiiiiiiiActivities: iiiiiiiiiiiiiiStart Date: 12/12/2004End Date: 14/12/2004Please reply to confirm Task.

Buttom line is, im not getting them on a new line like im supposed to. VBCrLf is giving me errors whenever i use it instead of chr$(13).

What do you think?
How can i have a text formatted, with each info on a line?

Thank you for your help.

View Replies


ADVERTISEMENT

Replace Vbcrlf

Dec 5, 2005

How do I replace vbcrlf in a string with "NN"

I have tried putting vbcrlf and "NN" as parameters into this but it doesn't work (maybe it can't see vbcrlf as a separate word!)

Function ReplaceWord(strText As String, _
strFind As String, _
strReplace As String) As String

' This function searches a string for a word and replaces it.
' You can use a wildcard mask to specify the search string.

Dim astrText() As String
Dim lngCount As Long

' Split the string at specified delimiter.
astrText = Split(strText)

' Loop through array, performing comparison
' against wildcard mask.
For lngCount = LBound(astrText) To UBound(astrText)
If astrText(lngCount) Like strFind Then
' If array element satisfies wildcard search,
' replace it.
astrText(lngCount) = strReplace
End If
Next
' Join string, using same delimiter.
ReplaceWord = Join(astrText)
End Function

View 1 Replies View Related

Public Function For Vbcrlf

Apr 5, 2008

I'm new to VB and am learing slowly with all your great help in this forum.

I'm wondering if its possible to write a Public Function for vbCRLF. I have a field in multiple forms that are all named 'Note'. If I have the following code:

Public Function PubNoteLF()
On Error GoTo PubNoteLF_Err

My!Note = My!Note & vbCrLf

PubNoteLF_Exit
Exit Function

PubNoteLF_Err
MsgBox Error$
Resume PubNoteLF_Exit

End Function

When I run the code I get Compile Error: 'Sub or function not defined.'

Can someone tell me what I'm doing wrong? Its problably something real basic, but I'm stumped. Thanks.

View 7 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved