We have our data source as an Access 2016 database.
I have some VBA code to connect the mailmerge data, works great!
SQL statement looks like this:
Code:
"SELECT * FROM [qryJobsCollate] WHERE ([JobNumber]=" & strJobNumber & " AND qryJobsCollate.CStatusID<>5 AND qryJobsCollate.CStatusID<>7);"
Our backend database is now moving to a MySQL database, and I'm having all sorts of trouble maintaining MailMerge functionality.
I have an ODBC driver installed, and that works well for Excel to connect to MySQL and do what it needs to do.
But Word is not playing the game.
Some of the difficulties...
MySQL only has tables, no queries. So if Word is to include the query statement, it's going to include joins be >250 characters...
Code:
SELECT tblJobs.JobNumber, tblJobs.JobName, tblClients.CompanyName, tblPeople.FirstName, tblPeople.FullName, tblClients.Address1, tblClients.Address2C, tblPeople.Email, tblJobClientLink.CStatusID
FROM tblPeople INNER JOIN (tblJobs INNER JOIN (tblClients INNER JOIN tblJobClientLink ON tblClients.ID = tblJobClientLink.ClientID) ON tblJobs.JobID = tblJobClientLink.JobID) ON tblPeople.ID = tblJobClientLink.ContactID
WHERE (((tblJobClientLink.CStatusID)<>5 And (tblJobClientLink.CStatusID)<>7));
Has anyone has success with MySQL, obtaining data from joined tables?
I'm leaning towards writing some intermittent code that grabs the data out of MySQL, and puts it into another format (eg Excel spreadsheet) for Word to MailMerge from.