How to use NextIf with a database field as parameter in mail merge based on SQL server view
Posted on 2004-09-24
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!'