variables in text string

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

what is the best way to handle displays that incorporate both data and other
“standard†text. For example, a letter that I want to insert a name in the
greeting, then some text, then another variable:

Dear <name>, I saw your client, <name>, today for her <something> etc.
I have broken up all the phrases between the variables and just called all
of them in order in the past. There must be a better way.
 
Hi Sam

One way to do this is to create a table with 4 fields.
Something like these fields and 2 example records:

DocName CodeName TableName FieldName
=========================================
rptLetter <name> tblClient Salutation
rptLetter <something> tblAppointment Topic

Then when you open the report, you can OpenRecordset on the records for this
report (DocName), loop through the records in this table, and use the
Replace() function for each one to replace CodeName with the contents of
FieldName.
 
Back
Top