Creating Form Letters (1 Viewer)

Weekleyba

Registered User.
Local time
Today, 12:12
Joined
Oct 10, 2013
Messages
586
I have a form where the user inputs data.
I then create a report based on those inputs.
The problem is, the report is a form letter and some of the fields are inside paragraphs. When the character length of the field changes, how can I force the paragraph in the report to grow or shrink around those text boxes?

e.g. (bold represents fields that would come from users inputs in the form.)

"Based on the provisions of Public Law 99 and requests from the Franklin Automated Controls Company, hereafter the Eagles Landing Estates, on the...."

Change the fields to short character lengths creates the spaces. (Had to use underscore for spaces to show up):

"Based on the provisions of Public Law 99 and requests from the ABC Company ___________________, hereafter the Sky Community ___, on the...."

Any help would be appreciated.
Thanks.
 

Ranman256

Well-known member
Local time
Today, 13:12
Joined
Apr 9, 2015
Messages
4,337
building internal form letters like this can be a pain. To keep the bold on some words and not others, means you must breakup paragraphs in order to get the bold words, etc.
Basically a jigsaw puzzle.
or
you can use Word mail merge which does a little better.

it may be the same amount of work for both versions.
 

Mark_

Longboard on the internet
Local time
Today, 10:12
Joined
Sep 12, 2017
Messages
2,111
Something like

Code:
Me.TxtField = "Based on the provisions of Public Law 99 and requests from the "
Me.TxtField = Me.TxtField & Me.CompanyName
Me.TxtField = Me.TxtField & ", hereafter "
Me.TxtField = Me.TxtField & Me.ShortCompanyName
Me.TxtField = Me.Txtfield  & ", on the...."

Put together your paragraphs as pieces, then put the pieces together when you format the detail portion of your report.

So long as your only doing a page or two this works well. For anything extensive I'd go with Mail merge like Ranman suggests.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 13:12
Joined
Feb 19, 2002
Messages
43,257
Newer versions of Access support Rich Text Formatting. You can create your paragraphs and include "tokens" that you can replace with actual values. I would use the <> to enclose the words. So at runtime, you would replace <CompanyName> with the contents of some bound control. Whatever formatting you assigned in the RTF control, will remain.

This isn't even close to as good as Word but it is a very good middle ground. The other alternative is to actually create Word documents that include bookmarks or form fields that you fill at runtime.

Here's a simplistic implementation of the Word solution. There are two files. One with the database and the second with the documents. Unzip them into the same directory for ease of use.
 

Attachments

  • SampleWordAutomation180206accdbNoDocs.zip
    413.3 KB · Views: 49
  • SampleLetters.zip
    446.9 KB · Views: 39

Users who are viewing this thread

Top Bottom