Jump to content

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
$AccessApp.DoCmd.OpenReport("rptProgramSetup").acViewPreview

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.

Link to comment
Share on other sites

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

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

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...