Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Word Merge problem

Status
Not open for further replies.

Soladmin

MIS
Feb 8, 2002
18
US
I'm doing a merge of data that's coming from a text file. I have the merge setup... The primary document has the fields dept, name and ID ... How can I tell Word to print the next record on the same page if the Dept field in the next record is the same as the one in the current record otherwise goto the next page and print the next record.
Is the NEXTIF mergefield meant to do that and if so what is the correct syntax?...I've tried all kinds of combinations and cann't get this to happen...Any suggestions?
 
{ SET Place1 { MERGEFIELD DEPT } }{ IF {Place2 } <> { Place1 }&quot;<ENTER>
<PAGE BREAK>
{ MERGEFIELD DEPT }<TAB>{ MERGEFIELD NAME }<TAB>{ MERGEFIELD ID }&quot; &quot;{ MERGEFIELD DEPT }<TAB>{ MERGEFIELD NAME }<TAB>{ MERGEFIELD ID }&quot;}{SET Place2 {MERGEFIELD DEPT }}<ENTER>

The IF statement compares the text of the bookmarks specified in the two SET fields. The text of the bookmark &quot;Place1&quot; is always equal to the current record's DEPT field, and the text of the bookmark &quot;Place2&quot; is equal to the preceding record's DEPT field.

If the DEPT name is the same as the preceding record, it inserts DEPT, Tab, NAME, Tab, ID and a Return Character. If the DEPT name is different from the preceding record, it inserts a Page Break followed by DEPT, Tab, NAME, Tab, ID and a Return Character.

BTW, my information is based upon Microsoft Knowledge Base Article 211303 which I found some time ago when working on a similar project.
 
Thank you very much for the info...I'll set it up this way and look into whatelse is available in the Microsoft Knoweldge base.
 
I got my mail merge to work.! thanks again...
One more question though... can you tell me how to create a form that allows the user to browse for the data source file that will be used in the merge. The tricky part for me is knowing what command to use to get this browse feature enabled and have a default text in the input box of the form
 
Sorry for adding 3 replies ...it's just that I'm making slow progress and keep coming up with questions...I don't know if I can edit a previously submitted Post...
in any case ... I recorded a macro as I was doing the merge but I need to add a section that will automatically set the correct field and record delimiters for the datasource.
Right now when I run the macro it stops to check what the field and record delimiters are first..and I have to type | for the field and ~ for the record the click ok...for the macro to continue to run.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top