View Full Version : Parsing and Replacing Data in a Memo Field


airforceruss
11-12-2008, 03:14 AM
Good Afternoon All,

I'm working on a database in A2003 that involved me allowing users to insert "Variables" or something similiar to Smarty tags in a Memo field that will be updated in a report with information in the database.

For example, the memo field would look like below:

%%FIRSTNAME%% received the Top Lobo award for class %%CLASS%%

%%FIRSTNAME%% would then be defined and would replace that entire phrase with the First Name of the individual the report is being generated for.

Any ideas on how I could go about this? I need to both find a certain string in a memo field and then replace it with that data in a recordset for the form.

Thanks!

DCrake
11-12-2008, 03:23 AM
There is a function called Replace()

Example

MyText = Replace(MyText,"%%CLASS%%",strClass)

Param 1 = the contents of your memo field
Param 2 = What you are looking to replace
Param 3 = What to replace it with

In the above example it will replace all instances of %%CLASS%% with the contents of strClass string variable.