![]() |
|
#1
|
||||
|
||||
![]()
I've had a bit of a play with your data. Try the attached - it assumes the mailmerge main document is saved in the same folder as your workbook. The DATABASE field's code for this is:
{DATABASE \d "{FILENAME \p}/../DB Merge Data.xlsx" \s " SELECT FORMAT([Date Of Incident]&' '&[Time], 'DD-MMM-YYYY @ hh:mm') AS `Incident Date & Time`, [Location], Format([Amount],'$#,##0.00') AS Amount, Format([Charge],'$#,##0.00') AS Charge, Format([Service Fee],'$#,##0.00') AS `Service Fee`, [Invoice Date] FROM [Detail$] WHERE [ID] = {MERGEFIELD ID} ORDER BY [Invoice Date] " \l "15" \b "49" \h} The field coding assumes the workbook name is 'DB Merge Data.xlsx' and that the worksheet name is 'Detail'. Change the names in the field to suit.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#2
|
|||
|
|||
![]()
This looks great, thank you!
Two follow up questions: is it possible to get the total of the amounts in the rows? also when I go to insert date { DATE \@ "MMMM d, yyyy" } then do Mailings > Finish & Merge > Edit Individual Documents it shows the code at the top instead of the actual Date. Strangely if I do CREATEDDATE that works. Thanks! |
#3
|
||||
|
||||
![]()
No.
Quote:
1. A plain DATE field will update every time you open the mailmerge output document. The Mailmerge Tips & Tricks 'sticky' thread at the top of this forum has an entry showing how to overcome that. 2. A CREATEDATE field returns the date the mailmerge main document was created, not the date the output document is created (unless you then do a SaveAs and refresh the field display).
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] Last edited by Charles Kenyon; 04-06-2019 at 06:23 AM. Reason: typo fix |
#4
|
|||
|
|||
![]() Quote:
|
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
Rushpac | Mail Merge | 2 | 01-27-2017 02:49 PM |
![]() |
mcboats2 | Mail Merge | 1 | 12-07-2015 05:01 PM |
![]() |
bluenosebex | Mail Merge | 5 | 08-02-2015 05:34 PM |
![]() |
jtemp57 | Word VBA | 10 | 12-16-2013 11:02 PM |
![]() |
nolesca | Excel | 4 | 06-07-2010 08:13 AM |