Solved

Choosing only data that is available - Excel

Posted on 2006-10-29
3
149 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
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 Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

744 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

15 Experts available now in Live!

Get 1:1 Help Now