Quote Originally Posted by Gicu View Post
Hello everyone,

I have developed in the past a module doing the exact "pseudo-merge" Paul describes here. I have stored in a table the "boilerplate" text and used db fields delimited by pipe characters to mimic mail-merge fields. Then in the report itself I used a custom function in the control source for the textboxes that replaces the "placeholders" with the corresponding values from the supplied source.
Attachment 37297
Code:
Public Function vcProcessText(ByVal OAString As String, strTable As String) As String
Dim a() As String
Dim v As Variant, vFieldValue As Variant
Dim sFieldName As String


On Error Resume Next
a() = Split(OAString, "|")
vcProcessText = ""
For Each v In a
    vFieldValue = ""
    sFieldName = Mid$(v, InStr(v, "|") + 1)
    
    If sFieldName = "" Then
        vFieldValue = ""
    Else
        vFieldValue = DLookup(sFieldName, strTable)
    End If
    vcProcessText = vcProcessText & IIf(vFieldValue = "", sFieldName, vFieldValue)
Next v




End Function
Attachment 37298

If interested let me know and I'll try to package all into a stand alone "utility" file on my website.

Cheers,
Vlad

hi Gicu
can you put it here or in your website?