Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Closed Thread
 
Thread Tools Display Modes
  #1  
Old 01-15-2018, 05:23 PM
macropod's Avatar
macropod macropod is offline Mail Merge: Using One Excel File with Multiple Sheets Windows 7 64bit Mail Merge: Using One Excel File with Multiple Sheets Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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.
Attached Files
File Type: docx Incident Merge.docx (28.1 KB, 338 views)
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
  #2  
Old 01-17-2018, 01:29 PM
Townshend Townshend is offline Mail Merge: Using One Excel File with Multiple Sheets Windows 10 Mail Merge: Using One Excel File with Multiple Sheets Office 2016
Novice
Mail Merge: Using One Excel File with Multiple Sheets
 
Join Date: Jan 2018
Posts: 4
Townshend is on a distinguished road
Default

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  
Old 01-17-2018, 03:25 PM
macropod's Avatar
macropod macropod is offline Mail Merge: Using One Excel File with Multiple Sheets Windows 7 64bit Mail Merge: Using One Excel File with Multiple Sheets Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by Townshend View Post
is it possible to get the total of the amounts in the rows?
No.
Quote:
Originally Posted by Townshend View Post
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.
That suggests you're typing the braces instead of inserting them via Ctrl-F9. Two things to note:
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  
Old 01-17-2018, 03:40 PM
Townshend Townshend is offline Mail Merge: Using One Excel File with Multiple Sheets Windows 10 Mail Merge: Using One Excel File with Multiple Sheets Office 2016
Novice
Mail Merge: Using One Excel File with Multiple Sheets
 
Join Date: Jan 2018
Posts: 4
Townshend is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
Possibly, but I'm not that fluent in SQL.

That suggests you're typing the braces instead of inserting them via Ctrl-F9. Tow things to note:
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).
QUOTE did the trick, thanks!
Closed Thread



Similar Threads
Thread Thread Starter Forum Replies Last Post
Mail Merge: Using One Excel File with Multiple Sheets Merge one Excel file into multiple Word Documents Rushpac Mail Merge 2 01-27-2017 02:49 PM
Mail Merge: Using One Excel File with Multiple Sheets Insert slip sheets during a mail merge mcboats2 Mail Merge 1 12-07-2015 05:01 PM
Mail Merge: Using One Excel File with Multiple Sheets Mail merge from excel - need to create sheets and create a table bluenosebex Mail Merge 5 08-02-2015 05:34 PM
Mail Merge: Using One Excel File with Multiple Sheets Code for mail merge to reference saved excel file jtemp57 Word VBA 10 12-16-2013 11:02 PM
Mail Merge: Using One Excel File with Multiple Sheets How do I merge data from one sheet in a workbook out into multiple sheets nolesca Excel 4 06-07-2010 08:13 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:17 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft