Results 1 to 4 of 4
  1. #1
    2 Star Lounger
    Join Date
    May 2005
    Posts
    180
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Security and automation (2007)

    I have a split database which calls a word document (mail merge from query) which works perfectly in both access 2003 and 2007. 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.

    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 & FormsLettersNew.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

    wrdApp.Visible = True
    wrdApp.Activate

    ExitHandler:
    Set wrdDoc = Nothing
    Set wrdApp = Nothing
    Exit Sub

    ErrHandler:
    MsgBox Err.Description, vbExclamation
    If Not wrdDoc Is Nothing Then
    wrdDoc.close SaveChanges:=False
    End If
    If Not wrdApp Is Nothing And blnStartWord Then
    wrdApp.Quit SaveChanges:=Nothing
    End If
    Resume ExitHandler
    End Sub

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Security and automation (2007)

    I don't have Office 2007, but does it help if you create a trusted location for the database in the Trust Center (Office button > Access Options> Trust Center > Trust Center Settings > Trusted Locations)?

  3. #3
    2 Star Lounger
    Join Date
    May 2005
    Posts
    180
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Security and automation (2007)

    yes I've tried putting both frontend and backend in trusted locations with the same results.

    nebbia

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Security and automation (2007)

    I'm afraid I can't help then. I hope someone with Office 2007 will jump in.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •