MS Word merging data into a single document from Database

M

mikeb2good

I'm a Newb at this. Here's my problem: I need a way to put data from
a single row of information from a SQL server database into a single
page of a Word Document. This data is selective (i.e., the information
doesn't go into a table). Moreover, I need to dynamically link with
the database to print out these single word docs one at a time, as
needed. For instance:
say I have product no. 234 and I need to insert a picture of it (it's
in the database as a name already), insert the production time say, and
also list a description of the object, and other like information, tell
who the suppliers of the raw materials are, what shape the product is ,
etc.
But then someone needs product 8777-23-0A, in a rush (with the same or
different information). So I need to be able to type in the product
no. (in Word, I hope) access the database, merge the answer into the
Word document, and print out the result in a jiffy.

I need it nicely formatted in Word (already done), and I need to access
this data and print it out whenever someone needs the information. I
don't have MS Access, but I do have Excel. So, if there is a way where
I could do this from Excel, it would be acceptable. I guess I could
always update the excel query every time a product is added. But keep
in mind that the excel spreadsheet for this query is already in the 3
Meg range.

I'm just trying to save myself the headache of copy, paste, copy paste,
format, format, copy, paste, format, routine.

As for Visual Basic for Word, I have had no prior experience with it. I
am familiar with Perl, though. So the ideas of a scripting language
are familiar to me.

I am not even sure this is possible in Word. I'm not sure if merge can
return a single unique identifier and their adjacent columns without
wanting to merge the data from all of the records.

Anyone have an ideas?
 
D

Doug Robbins - Word MVP

You could use a userform on which you have a list box that you load with the
data from Excel using the information in the article:

"Load a ListBox from a Named Range in Excel using DAO" at:

http://www.word.mvps.org/FAQs/InterDev/FillListBoxFromXLDAO.htm

and then select the item in the list box and transfer the data from the item
into the Word document

Also see:

"How to create a Userform" at:

http://word.mvps.org/FAQs/Userforms/CreateAUserForm.htm

and

"How to find out which Items are selected in a Multi-Select ListBox" at:

http://www.word.mvps.org/FAQs/Userforms/GetMultiSelectValues.htm


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 

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