MS Access Escape characters

Im trying to find out the correct escape codes to insert values in my memo fields

The memo field would look something like this
Hello Forms![frm_sales]![firstname],  I called and left you a voice mail a few weeks back
If I msgbox or have the code email this field out, I would like it to read
Hello Joe,  I called and left you a voice mail a few weeks back


I cant field the correct escape code to replace the field name with the actual value.. Any help would be greatly appreciated

Thanks
joein610Asked:
Who is Participating?
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Connect With a Mentor Infotrakker SoftwareCommented:
You're looking to include "tokens" or "placeholders" in your Memo field - in other words, you wish to have Text in the Memo field that could be used when generating a message, and you want that Text to dynamically grab the data from frm_sales? If so, then you can do this using specialized coding and placeholders. Enclose all of your placeholders in some unique syntax (for example: <CustName>).

When you need to use this Text value, add it to the form/report (or whatever object you need) and then build a routine that uses the Replace function to input your data:

Me.YourTextField = Replace("<CustName>", Forms("frm_Sales").CustomerName)

And so on for all your "tokens".
0
 
Rey Obrero (Capricorn1)Commented:

Dim msg As String

msg = "Hello " & Forms![frm_sales]![firstname] & ", I called and left you a voice mail a few weeks back"

MsgBox msg
0
 
joein610Author Commented:
That the code works if it place that syntax in VBA editor.. but in this instance the memo field contains..
"Hello " & Forms![frm_sales]![firstname] & ", I called and left you a voice mail a few weeks back"


If I msgbox me!memo1  I get the same text as in the memo field
"Hello " & Forms![frm_sales]![firstname] & ", I called and left you a voice mail a few weeks back"


0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
Rey Obrero (Capricorn1)Commented:
do you mean you entered these

"Hello " & Forms![frm_sales]![firstname] & ", I called and left you a voice mail a few weeks back"

in the table?
0
 
joein610Author Commented:
Correct... sorry for the confusion
0
 
Rey Obrero (Capricorn1)Commented:
if you really want this to come from table fields, add another field, say greeting (text)

enter
Hello in greeting field

enter
I called and left you a voice mail a few weeks back    in memo field

add the greeting field to your form, now you can do this


msgbox  me.greeting & " " & Forms![frm_sales]![firstname] & ", " & Me.memo
0
 
joein610Author Commented:
Gotcha... Thanks what I have now..  I must of been too was optimistic that there was something better :)

Thanks For your help!
0
 
joein610Author Commented:
Let me try that...--  Sound pretty decent .. .. and I can prob make it compatible with my php programmers code.
0
 
joein610Author Commented:
I had a slight error with arguments because the orgianl field name  was missing, so i replace the code with

me!Me.YourTextField = Replace(Me.YourTextField, abc, "{first}", Forms![frm_sales]!CustomerName)


THANKS!!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.