View Single Post
 
Old 12-22-2012, 12:18 AM
WayneCusack WayneCusack is offline Windows 7 32bit Office 2010 32bit
Novice
 
Join Date: Dec 2012
Posts: 4
WayneCusack is on a distinguished road
Default importing Access data to a Word document

In the past I have created document templates that drew data from an MS Access database. Now, using Word 2010 and Access 2010, I cannot open the database to draw out the data. I get error messages - either the database cannot be found or the file format is invalid.

The old templates connected to an "mdb" database using code like this:

var1 = "SELECT * FROM Lawyer WHERE [LawyerName] = Wayne Cusack" & Chr(34) & var1 & Chr(34) & "ORDER BY Ordernumber;"
Set db = OpenDatabase(Name:="C:\Work Matters\Databases\Lawyer.mdb")
Set rs = db.OpenRecordset(var1)

I understand that the default Access file type has changed from "mdb" to "accdb". When I save the new database with an "accdb" extension I get the message saying it is invalid - if I leave off the extension or use "mdb" I get a message saying the file cannot be found. I have tried using "Save As" under the "Save And Publish menu to store the database in an older format, but that does not solve the problem.

How can I connect to the database to draw out data to be used in a Word template?
Reply With Quote