Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Build an Access executable from command line?

We have a legacy Access application that is still in production. I would like to at least have an automated build for it. Can you build access exe's from the command line?

Even better, there wouldn't by any chance, be an MSBuild target for Access would there?

like image 253
JMarsch Avatar asked Feb 24 '26 01:02

JMarsch


1 Answers

This works for me 2010. Needed some time to manage that.

Function makeAccde()
    Dim source, temp, target As String
    DoCmd.RunCommand acCmdCloseAll 
    source = CurrentProject.path & "\" & CurrentProject.name
    temp = CurrentProject.path & "\" & "_tmpCompile.accdb"
    target = Left(source, Len(source) - 1) & "e"  'you can also use "r"
    Dim db As New Access.Application
    DoCmd.RunCommand acCmdCompileAndSaveAllModules

    Set aFSO = CreateObject("Scripting.FileSystemObject")
    aFSO.CopyFile source, temp, True

    db.AutomationSecurity = msoAutomationSecurityLow
    db.SysCmd 603, temp, target
    db.Quit
    Kill temp
    Application.Quit ' if you do not quit current db, sometimes target file is corrupted.
End Function
like image 184
SalkinD Avatar answered Feb 25 '26 18:02

SalkinD



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!