Web Hosting Talk







View Full Version : Mail Merge


zacharooni
06-21-2006, 02:35 PM
OK, here's the problem i'm having, if anyone has experience with this, please let me know.

K, here's the setup:

SQL Server is a standalone machine running Windows 2003 Server.
This does NOT have an internet connection for credit reasons.
It does however sit beside a domain controller so that the workers can log on and do their job.

Anywho, the workers need to pull client records into a Word template using Mail merge, but the data exists in two tables, and i've never used mail merge to pull that kind of data. Basically all I need is Name, Address, City, State, Zip, BUT in the same document I need Bank Name Bank Address and other information that if it's there it needs to be put on the form. The only problem is, that data is in the other table, and i'm not quite sure how to set it up to pull data from the other table.

I've installed MySQL Connector, and set up the DSN and that part works, and I have the IP access correctly setup, so that's not an issue there.

JBelthoff
06-21-2006, 05:21 PM
You stated SQL Server but then said you use MySQL Connector.

Anyway if you are using SQL Server then you would somply create a view and join the 2 tables based on your query. Then use the view as opposed to the raw tables.

I'm sure MySQL would be similar but I do not know the correct terminology of MySQL.

:peace:

zacharooni
06-21-2006, 05:38 PM
OK Sorry, I was on my boss's computer, and he posted this thread without me finishing it.. bastard.. anyway

I have MySQL 5.1 installed on the server. I have the MySQL connector installed on the client. I need to be able to modify the SELECT statement in Word using Mail Merge or some other way.

JBelthoff
06-21-2006, 06:12 PM
I need to be able to modify the SELECT statement in Word using Mail Merge or some other way.

Sounds like you simply need to do an SQL JOIN on 2 tables to me.

Select *
From Table1 a
Inner Join Table2 b on a.ID = b.ID

:peace:

zacharooni
06-21-2006, 09:29 PM
I know how to do the statement, just not in Word

JBelthoff
06-21-2006, 10:52 PM
You wouldn't do it in word, you would do it in the database.

Create a MySql "view" with the table join and then connect to the "view" in word as opposed to connecting to the table.

http://dev.mysql.com/doc/refman/5.0/en/create-view.html

:peace:

zacharooni
06-22-2006, 10:44 AM
I think I love you. Thanks!