Creating a customized field or merging with non-address fields

R

Richard Veysey

I am trying to create a C++ program with many members of
a single class and wanted to simplify the creation of all
the members by creating a template with Microsoft Word
and a Database with all the data and then merging them.
Just in case, I'll include an example of what I want to
do...

{OBJECT}.SetName("{Name}")
{OBJECT}.SetData1("{Data1}")
Etc., Etc.

These aren't the fields I wish to use, but they'll do for
now. Anyway, I cannot seem to merge my database with my
word document which means that I have begun to worry that
my big time saver is just a big time waster. Is there
any way to either create a custom field in Word, or to
use the existing mail merge wizard to merge in my data
from my database into the document.

Thank You
Richard V
 
P

Peter Jamieson

It isn't at all clear from your description what you are actually
hoping to use as your data source, what the field names might be, and how
you are hoping to get the data into the resulting document. So I may have
misunderstood your question completely, but I hope the following makes
sense:

In essence, your data source needs to be a 2-D table (i.e. with columns and
rows, with a field name for each column and, usually, the same number of
columns in each row). That might be implemented in a number of different
ways, e.g.
a. a comma-delimited text file with e.g.

fieldname1, fieldname2, fieldname3
row1field1value, row1field2value,row1field3value
row2field1value, row2field2value,row2field3value
row3field1value, row3field2value,row1field3value
etc.

b. the same thing in a Word document
c. a table in a Word document
d. an Excel worksheet
e. a table or query in an Access database
f. a table or view in any database you can access via ODBC
g. separate data and header fiels are allowed for some types of file
...etc.

What it cannot be is a disconnected recordset or some structure purely of
your own invention.

What you need to get Word mailmerge to merge the data in from that data
source is to use { MERGEFIELD } fields whose names correspond to the columns
in your table, e.g.

{ MERGEFIELD fieldname1 }

You would either have these mergefields in your Word document already, or
use the methods of WOrd's MailMerge object to insert them.

For everything else, you need to have a look at Word's MailMerge object's
methods, properties etc.

Alternatively you can avoid Word's built-in MailMerge altogether and "roll
your own" merge, but then it's up to you how to decide where to put each
field in your data source, etc. etc.
 
R

Richard Veysey

It is giving me a message saying that I can't use fomulas
with mail merge, so I'll try taking out the formulas and
see if that fixes anything... It didn't give me that
message before. Hopefully that will fix my problem, but
if not, I'll tell you anything else that might be
relevent. Thank you for all your help, and I'm sorry I
didn't give you enough info. Many people would have
totally disregarded a request that is so vague, so thank
you again for your time and suggestions.
Richard Veysey
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top