Solved

Choosing only data that is available - Excel

Posted on 2006-10-29
3
160 Views
Last Modified: 2010-04-30
Hello

I am working on a ordering process and trying to automate it.  I will give you an example of what I am trying to do below.

When I receive orders for some of my products I place the order in an Excel spreadsheet (address, order #, qty of each product).  For each order, it is placed in one row, so if I have an order going to John Smith and he orders 3 out of the 20 products that I have to offer these are all inserted in the same row.  From there I run a mail merge in Word to generate a packing list/invoice.  What I am looking to do is make it so only the products that are ordered show up on the invoice without specifying a specific place on the Word template for each product.  

Is there a Macro that I could use to make this happen?

Please let me know if you need more info.

Best Regards
wdelaney
0
Comment
Question by:wdelaney05
[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
3 Comments
 
LVL 92

Expert Comment

by:Patrick Matthews
ID: 17831153
Hi wdelaney05,

I would recommend you rethink the way this works.  From your description, it shounds like each product
occupies a different column.  From a data modeling perspective, this is a bad choice.

In my opinion, you will be far better off in the long run by using a database app instead.  Access actually
comes delivered with a simple order entry template that I suspect will handle your needs with just a little
tweaking.

Regards,

Patrick
0
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 500 total points
ID: 17832667
However, Word mailmerge is not designed to work with the one-to-many query that would be necessary to join the customer details to the order details, so you would have to use Access reporting. There's nothing wrong with that in the long run, but you would have to familiarise yourself with quite a lot.

Meanwhile...

Presumably you have a very limited number of products.

You could make each item only show if the quantity is greater than 0. This requires your MAILMERGE fields to be nested inside IF fields. It would be best to show the field codes (Alt+F9 toggles on and off). Do not type the {} pairs in, either enter them with Ctrl+F9 or as part of a field insertion.

{ IF { MAILMERGE "qtyA" } > 0 { MAILMERGE "ProductA" } "" }                 { IF { MAILMERGE "qtyA" } > 0 { MAILMERGE "qtyA"} "" }
{ IF { MAILMERGE "qtyB" } > 0 { MAILMERGE "ProductB" } "" }                 { IF { MAILMERGE "qtyB" } > 0 { MAILMERGE "qtyB"} "" }  

In Word 2000, you get an option to supress any blank lines that might result. In Word 2003 it's done without asking.

 
0
 

Author Comment

by:wdelaney05
ID: 17838154
Thanks you two for the answers.  I agree with you on the Access database.  That is something I need to do some more research on to utilize.  

Best Regards,
wdelaney05
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

763 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