security and automation

N

nebbia

I have a split database which calls a word document (mail merge from
query) which works perfectly in both access 2003 and 2007on an XP platform. I
have
secured the frontend and backend (user level security) in 2003 also
without problems. I have tried to migrate the same files to an access
2007 without success. I receive error messages that I don't have
permission to access the frontend or OBDC login failures.If I remove the
security it works fine

I've played with this quite a bit and can not find a solution. Is this
a bug in 2007 or am I missing a reference or something else entirely
This is the code I've been using;

Private Sub cmdMerge_Click()
Dim wrdApp As Object
Dim wrdDoc As Object
Dim blnStartWord As Boolean
Dim strSQL As String

On Error Resume Next

Set wrdApp = GetObject(, "Word.Application")
If wrdApp Is Nothing Then
Set wrdApp = CreateObject("Word.Application")
If wrdApp Is Nothing Then
MsgBox "Can't start Word.", vbExclamation
Exit Sub
Else
blnStartWord = True
End If
End If

On Error GoTo ErrHandler

strSQL = "SELECT * FROM qryNew"

Set wrdDoc = wrdApp.Documents.open("c:\Templates & Forms\Letters
\New.doc")
With wrdDoc.MailMerge
..OpenDataSource _
Name:="", _
LinkToSource:=True, _
Connection:="DSN=MS Access Database;DBQ=" & CurrentDb.Name, _
SQLStatement:=strSQL, _
SubType:=8 ' = wdMergeSubTypeWord2000
..SuppressBlankLines = True
End With
 

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