Microsoft Office Forums Combining Records of two sheets with Loop till Unique ID

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-21-2014, 03:43 AM
abhilashv abhilashv is offline Combining Records of two sheets with Loop till Unique ID Windows 7 32bit Combining Records of two sheets with Loop till Unique ID Office 2007
Novice
Combining Records of two sheets with Loop till Unique ID
 
Join Date: Jan 2014
Posts: 1
abhilashv is on a distinguished road
Unhappy Combining Records of two sheets with Loop till Unique ID

Hi,

I am making a family directory and have two sheet of records with unique Parent ID same in both sheets , 1st sheet is the details of Parents and second sheet is with Family members or childs. I have multiple records in sheet 2 reference to parent ID.

I want to combine this using mail merge and want all the records of 1st sheet coming at top of my mail merge sheet and below want all the child Family members come with respect to above Parent ID



Please Guide.
Reply With Quote
  #2  
Old 01-22-2014, 04:02 AM
macropod's Avatar
macropod macropod is offline Combining Records of two sheets with Loop till Unique ID Windows 7 32bit Combining Records of two sheets with Loop till Unique ID Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 19,524
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

You cannot do this via a Word mailmerge on its own, as a Word mailmerge can only use one data source (in this case, that's one worksheet). You could, however, combine the mailmerge of the sheet containing the parent data with a DATABASE field that extracts the corresponding Family member data from the Family members sheet. Coding such a DATABASE field would require you to have an understanding of both SQL (as you need an SQL statement to extract the data) and the field switches Word uses to tabulate the DATABASE field's output. Plus, this would only be useful if the Family member data were on separate rows for each member - not all on the same row. To give you an idea of what's involved, such a DATEBASE field's code might be:

{DATABASE \d "C:\\Users\\Some User\\Students.xlsx" \s "SELECT [LAST NAME], [FIRST NAME], FORMAT([BirthDate], \"DDD, D MMMM YYYY\") AS [Birth Date] FROM [Family Members$] WHERE [Family ID] = \"{MERGEFIELD Family_ID}\" ORDER BY [Birth Date]" \l "37" \b "51" \h}
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Combining Records of two sheets with Loop till Unique ID Combining 2 workbooks into 1 workbook with TWO sheets dguenther Excel 1 10-06-2011 03:25 AM
Linking sheets to fetch transactions from sheets to another waqer Excel 4 09-01-2011 12:35 PM
Combining Records of two sheets with Loop till Unique ID Deleted mail from archive till show in search Davoud Teimouri Outlook 1 09-01-2011 09:46 AM
If two geographical data match in two sheets, copy unique id/code found in one sheet alliage Excel 1 09-01-2011 05:23 AM
From a particular cell till the end of the same column tinfanide Excel 3 08-10-2011 05:09 AM


All times are GMT -7. The time now is 01:07 PM.


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