Execute an access DB macro from VB.NET

Hi,

I am having problems trying to execute an access DB macro from my VB.NET APP. Any help is welcome.

Thanks Mike


Answer this question

Execute an access DB macro from VB.NET

  • jchmack12

    Hi,
    Thanks for the code. I have it working now. The only part that I could not get to work was the "CloseCurrentDatabase"; however, the quite command worked great.

    Thanks Again Mike

  • Ole Gulbrandsen

    Mike,

    One way this can be done is to include the reference to Microsoft Access object library in COM, and the use the OpenCurrentDatabase.  You can keep it hidden in the background, however if there is an autoexec macro or a startup form then this will cause the application to be displayed.

    Here is a code sample on how to achieve this



    Dim Adb As New Access.Application
    Adb.OpenCurrentDatabase("Path To the database")
    Adb.Run("procedure name to be ran..")
    Adb.CloseCurrentDatabase()
    Adb.Quit()


     

  • Execute an access DB macro from VB.NET