Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Similar to the OpenArgs property of the Form object, am I able to open the Access Application itself with a passed parameter (say from a .bat file)?

Basically I'm looking to speed up the user's experience by having variable links to .bat files that open the same file, but to a different menu screen etc.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
938 views
Welcome To Ask or Share your Answers For Others

1 Answer

Use the /cmd command-line parameter to start Access, and the Commmand() function in Access-VBA to read it.

"C:Program Files (x86)Microsoft OfficeOffice14MSACCESS.EXE" D:WorkmyDb.accdb /cmd foo

and this function called by an Autoexec macro:

Public Function AutoExec()

    Dim sCmd As String

    ' ... other initializations ...

    ' Read /cmd command-line parameter
    sCmd = Command()

    Select Case sCmd
        Case "foo": Call Foo()
        Case "bar": Call Bar()
        Case Else: Debug.Print "No valid command-line parameter passed."
    End Select

End Function

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...