#1
|
|||
|
|||
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. |
#2
|
||||
|
||||
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 [Fmr MS MVP - Word] |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
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 |
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 |