使用参数打开Microsoft Access [英] Opening Microsoft Access with parameters

查看:84
本文介绍了使用参数打开Microsoft Access的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

类似于Form对象的 OpenArgs 属性,是否可以使用传递的参数(例如,.bat文件中的参数)打开Access Application本身?

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)?

基本上,我希望通过具有指向.bat文件的变量链接来加快用户的使用体验,这些文件可以打开同一文件,但可以指向不同的菜单屏幕,等等.

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.

推荐答案

使用/cmd命令行参数启动Access,并使用Access-VBA中的Commmand()函数读取它.

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

"C:\Program Files (x86)\Microsoft Office\Office14\MSACCESS.EXE" D:\Work\myDb.accdb /cmd foo

,此函数由Autoexec宏调用:

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

这篇关于使用参数打开Microsoft Access的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆