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,098 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Do you ever need to create a 20 page Word document for some testing purpose? Are you tired of copying & pasting old boring "lorem ipsum" text over and over again, increasing font size and line space in order to make the document 20+ pages long? Look…
A few years ago I was very much a beginner at VBA, and that very much remains the case today.  I'll do my best to explain things as I go in the hope that other beginners can follow.  If you just want to check out a tool that creates a Select Case fu…
This video walks the viewer through the process of creating a watermark for their document, customizing it, and saving it for viewing/printing needs.
This video teaches the viewer how to align pictures around text while keeping the text properly aligned in the document.

635 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