Jump to content
Sign in to follow this  

Developer's reference for objects?

Recommended Posts


I'm trying to program a few tasks I normally do in Excel and Access into AutoIt, and while I've gotten the basics done, I'm struggling to port over some VBA code. For example, I have this code to essentially filter a report based on a date I enter into a text box:

Const conDateFormat = "\#mm\/dd\/yyyy\#"
strReport = "rptProgramSetup"
strField = "ProgramEnd"
; Irrelevant code
strWhere = strField & " Between " & Format(Me.txtStartDateMenu, conDateFormat) _
            & " And " & Format(Me.txtEndDateMenu, conDateFormat)
DoCmd.OpenReport strReport, acViewPreview, , strWhere

I can get the report to open fine like so:

$AccessApp = ObjCreate("Access.Application")
; Irrelevant code

But it sends it directly to the printer rather than opening in Print Preview mode. I'm having similar issues with the other arguments of OpenReport. I was hoping someone could help me out with this, or perhaps point me in the direction of a useful developer's reference for doing this sort of stuff.

Thanks a bunch.

Share this post

Link to post
Share on other sites

Well I figured out how to run a macro from AutoIt:

With $AccessApp.
    .OpenCurrentDatabase ($Database)
                   ; Irrelevant
    $DummyVar = .Run("MyMacro")

But this only works if MyMacro is defined as a public function in a module. It doesn't seem to work for subroutines or functions in a form.

Any ideas?

Edited by pete1234

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this