Nesting a table in a Word Merge

craigachan

Registered User.
Local time
Today, 15:24
Joined
Nov 9, 2007
Messages
285
I have a query of patients who have many transactions per patient. I want to merge a letter to their doctors. Each letter reports each patient's transactions. I want to display the transactions in a table on the Word Doc so that everything lines up well.

Then I want to batch a series of letter, for example, all the patients seen that day. which will be addressed to each patient's doctor.

I can come up with the query, but I have a problem setting up the table in the word document and populating it. The letter will look like this:

Doctor
Doc Addr

Patient:

Narative

Patient Trans 1
Patient Trans 2
Patient Trans 3

Etc.

There might just be one transaction and there might be 20 transactions per patient.

Can anyone help me do this?
 
Hopefully you will get something better than this as I think this would be too slow for mail merge....I guess it depends on how many letters.

Firstly, open the data base window and click on the query name and then Copy. Open your Word.doc and then go to Edit>PasteSpecial. That will open a box with two options and you select link.

Close and save. Reopen letter (data base must be open) and you will see the query in the letter.

The fun part is formatting it. I find it a real pain but my knowledge on Word is pretty basic. I have it formatted so it looks like I just typed in the numbers.

To format it make sure your query has more records than it is ever likely to have, in other words add a few dummy records. Once it is formatted the display in Word will shrink and expand up and down according to number of records Unless the number of records exceeds what you formatted for then the excess records will be all over the place. Writing that is under the query display will move up and down with the query. This needs to be taken into account with paragraph/bottom of page issues.

Once you have formatted the letter then do not close/save.....close and don't save. The reason is that if you only had 2 records then it will save that format and if the next letter is for 10 records then 8 of them will be all over the place. I also have the letter open but I manually print/close. That allows me to do spacing etc because there is writing below where the query appears. So not good mail merge stuff unless numbers are small. I don't know if this will work in the standard Access/Word mail merge wizard.

I use Access to insert data in bookmarks and and only do a few at a time which I do manually. That is, I find the record I want and then run it.

My situation is similar to your except is is insurance policy details. However, I do the letter on its own and have policy details print out on form and/or report and with info in the header.
 
have you look at the super easy word function - (check samples)
this will probably sort you out ,

unless you really want a table (with grid lines) - if you could live without rid lines then this might work for you

- my take on this would be set up the word doc - with xx amount of merge fields for records - or populate a memo field in the format you want

i.e

Patient xxx
Treatment (carrage return)
Headache - prescription- asprin
Toothache - prescription - petrol
sprained ankle - presciption amputation

then just merge this field
 
Thanks for your comment and suggestions. I guess what I'm looking for is a Word template, linked to and Access database. I want the word template to function like an Access Form with a subform or an Access Report with a subreport. I know I could do this in an Access Report, but I like the versatility of Word to edit on the spot. The table in my Word document should function just like the 'Details' section of my report which can have up to 3 column, all lined up nicely.

And I want to automate this whole process. Any suggestions?
 
Actually I am in the process of fiddling with some of my stuff at the moment.

What I just did was a combination of the MailMerge for name, address etc and copied the query in. All worked find. However, when you open the letter there are two message boxes

One about Select from Table etc click Yes
One about query updating etc click yes

Letter is then ready for print/merge or document/merge.

You can insery MergeFields in a WordTable OK but it is no good for this type of exercise because in reality each Word.doc formed is a One to Many kind of things.

What Gary said about a Memo field would work if you can the Many records into it. The only way I know how to do that is with a combination of SendKeys and code or macro running copy/paste from GoToControl. However, I am reluctant to use SendKeys because one computer has Vista and they won't work and I can only keep XP for so long

I want the word template to function like an Access Form with a subform or an Access Report with a subreport. You can format it in Word to look just like a table including field headings (that is the default but you drag across for width. Or you can format all the way to making it look like you types in the entries

That is exactly what linking the query/table is about.

As a side note I can only get MailMerge (Office 2003) to work from a table. I fixed that by a Delete and Append query to the table from the Query that is required.

For "nice to use" the insertion of Access data into bookmarks for name, address etc is best and with the linked table. However, it is a fair bit of work as you run it from your form with the form moving from record to record and running the code to open the letter. But it is very slow with a linked query.
 
I just used code to open the letter from my form and the letter opened without any msg boxes asking for comfirmation.

However, all the tool bar part of Word for Merge to Printer and Merge to Document are greyed out. The query is updated OK
 
OK - lets drop word for a mo..

are you printing 1 report at a time or batch printing

if its one at a time have a memo field in the underlying table and write some stuff in there then preview report -print etc

if its a batch print and the notation/message isgoing to be the same on eachg letter - then in your batch printing form - have a memofield on the form and have you notation-message in their - this then will become part of the print job,.

coming at this from another angle

I have to abde by compliance (phaw- lot of Bullsh*t)- anyway ihave to keep a record of what has been sent - dumping into word would involve having a copy of a each letter - - where as - keeping it within the D/b - would not -

various routes on letters(access reports) that do this sort of thing -

just my pennies worth
 
I might have figured out a way to do it. But I don't know VB. Could someone write a Function called CR() that simply does a carrage return?

Thanks for your help.
 

Users who are viewing this thread

Back
Top Bottom