Solved

How to use NextIf with a database field as parameter in mail merge based on SQL server view

Posted on 2004-09-24
3
1,078 Views
Last Modified: 2008-01-09
Hi, guys.

I have been looking for a solution to this for a day now and I am getting a bit frustrated! I saw a similar request regarding a library system earlier, but without a real answer.

What I am trying to do should in my opinion be fairly easy, but somehow I cannot get the NextIf function of the mail merge in Word 2003 to work how I want it to:

I have a table (it is really a view on my SQL server) that has information regarding the orders placed by certain customers. For each item ordered by a customer, the table contains one line of information.

Thus, for a given customer there could be one or several records in the table.

What I want to do is to print a order confirmation for each customer, including the contact information and basic order information only once (of course), but be able to include all the order details (item number, item name and price) in this letter.

What I have tried to do is to use the NextIf function, but somehow it seems this will not accept a mailmerge field (aka a database field) as a parameter to compare with.

Could someone please enlighten me on how to achieve this? Is it at all possible? And if it isn't, what the %&) are the guys at Microsoft thinking..... There must be a million uses for this particular functionality!

Regards, and I hope someone points at me real fast and say 'Here's how, stupid!'
Andreas



0
Comment
Question by:obiwankenobi
  • 2
3 Comments
 
LVL 37

Accepted Solution

by:
Joanne M. Orzech earned 125 total points
ID: 12144793
Believe it or not - it's not easy.... it's almost impossible to do this!  Having said that, here's a post with a macro that might help:
http://www.experts-exchange.com/Applications/MS_Office/Word/Q_20863318.html

I know some people who know some people who know how to do this... I just have to find the right link :)

Will post back.
0
 
LVL 5

Expert Comment

by:Miles_stylus
ID: 12198263
if it is proving this hard within word why not use a report with a sub report?  Thus the main report would contain all the single instance information (contact, overal price etc) with a sub report showing all the detail information?

Then rather than running the report in word your would print it straight from your datebase?

HTH

Miles
0
 
LVL 37

Expert Comment

by:Joanne M. Orzech
ID: 12375615
Thanks obiwan!
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This is written from a 'VBA for MS Word' perspective, but I am sure it applies to most other MS Office components where VBA is used.  One thing that really bugs me is slow code, ESPECIALLY when it's mine!  In programming there are so many ways to…
Microsoft Word is a program we have all encountered at some point, but very few of us have dug deep into its full scope of features, let alone customized it to suit our needs. Luckily making the ribbon (aka toolbar, first introduced in Word 2007) wo…
This video walks the viewer through the process of creating an MLA formatted document, as well as a bibliography with citations.
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now