Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2003
    Posts
    15

    Unhappy Unanswered: OpenCurrentDatabase with MDW

    This works fine, but how to do the some work with a mdb protected with a mdw?

    Dim app As New Application
    app.OpenCurrentDatabase ("c:\abc\abc.mdb")
    app.DoCmd.Rename "Mailing_old", acQuery, "Mailing"
    app.DoCmd.Rename "Mailing_old", acForm, "Mailing"
    app.DoCmd.Rename "Mailing_old", acReport, "Mailing"

    app.CloseCurrentDatabase
    Set app = Nothing

  2. #2
    Join Date
    Sep 2004
    Location
    Reston, VA
    Posts
    86
    You have to set up a connection first. Try this:

    Code:
    Dim app As New Application
    Dim cnn As New ADODB.Connection
    
    Set cnn = New ADODB.Connection
    cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\abc\abc.mdb;Mode=Share Deny None;" & _
            "Jet OLEDB:System database=workgroup_name.mdw", user_id, password
    
    app.OpenCurrentDatabase ("c:\abc\abc.mdb")
    app.DoCmd.Rename "Mailing_old", acQuery, "Mailing"
    app.DoCmd.Rename "Mailing_old", acForm, "Mailing"
    app.DoCmd.Rename "Mailing_old", acReport, "Mailing"
    
    app.CloseCurrentDatabase
    cnn.Close
    
    Set cnn = Nothing
    Set app = Nothing

Posting Permissions

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