Consulting

Results 1 to 2 of 2

Thread: Problem with Excel - Access macro

  1. #1

    Problem with Excel - Access macro

    hi Guys

    I'm trying to get Access to open and run a macro from Excel. Ultimately this will close access after it has run the process as I don't want users to be able to access the database directly.

    However, I'm having some problems getting the code to run. I have Excel referenced to the Microsoft Access 11.0 Object Library but am still getting a Runtime Errror 7866 claiming that the database is open by another user or missing, neither is true.

    Can anyone suggest\advise where I'm going wrong? I have searched the forum and have tried a solution suggested, but this doesn't seem to be taking effect. Using 2003 because they won't give me anything better!!

    [VBA]Sub RunAccessMacro()
    Dim appAccess As Object
    Const strConPath = "Y:\Planning and Performance\Access\"
    strDB = strConPath & "Revenue Test 2.mdb"
    Set appAccess = CreateObject("Access.Application")

    With appAccess
    Application.DisplayAlerts = False
    .OpenCurrentDatabase strDB
    .DoCmd.OpenModule "Revenue Upload"
    .Run "Normalupload"
    '.Quit
    End With
    Set appAccess = Nothing
    End Sub[/VBA]

    Thanks

    Phel x

  2. #2
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,956
    Location
    Did you try?
    [VBA].DoCmd.OpenModule "Revenue Upload", "Normalupload" [/VBA]

Posting Permissions

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