Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

address from db to Word 1

Status
Not open for further replies.

Achmed

Technical User
Jun 4, 2001
64
CA
I'm trying find a quick way to take a mailing address from a contact list database form and copy it to Word for letter writing. The addresses are set up in separate fields (street, city, province etc.) and I can't figure out how to copy the entire address. Any ideas?

Thanks.
-Alan
 
You could try creating a mail merge from Word using your dabase as a source. I'm not sure of the specifics of how to set this up but you might want to try starting there.
 
I am using a mail merge now, but this way I get all of the records, and not just one. I'm trying to find a way that is quick to use for a single address directly from the form.

Does anybody know how to insert a new line in a text box? If that works, then I could do something like this, but I don't want it all on one line.

=[First Name]&" "& [Last Name] & NewLine & [Street]

-Alan
 
Hi Alan!

Actually, there are two parts to what you are trying to do:

1. select a record for merging

2. merge specific fields in the selected record

This should be pretty easy if your tables are constructed correctly. I am assuming that you already have a table that looks something like this:

tblNames
========
NameKey
FirstName
LastName
etc.

That key value is what will allow you to merge a specific record or group of records.

Start with building a query consisting of the fields you want to merge. Don't bother trying to concatenate all the fields in a single box, but you might want to concatenate the city, state, zip line together as well as the first and last name.

Now you can go one of two routes -- use a parameter to select the name or names to merge, or build a form with a selection option (combo box etc.).

Let's do the first option so you see how this works, then you can make it more sophisticated later. Let's say you want to select by first and last name. In the query, put the following in the first name criteria row: [Enter first name]. In the last name column, type [Enter last name]. Make sure you include the square brackets!

When you test this select query, it will ask you for the first name then the last. You will now see only those records that match that criteria.

Now, in the database window, click ONCE on that query. It is now selected. Go up to the toolbar at the top and select Merge with Word from the Office button. Either select an existing document or choose to create a new one. The document will now have the merge toolbar available and you can drop in your fields.

For the user interface, just add a button from your switchboard to run a macro that opens this document. It will go ahead and make the connection to the database, prompt for the names and then show only those records on a letter ready to be created.

This is pretty rudimentary, but it will work fine and you can improve on the interface as you become more confident!

Pamela
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top