Start the MDB file in Access with the specified workgroup file

Source: Internet
Author: User

After the program has been handed over to the user, it is required to use the specified workgroup file each time it is started, in roughly the following ways:

1. Use a shortcut to specify the workgroup file with the startup parameters;

2. Specify a workgroup with the Access built-in Workgroup administrator.

3. You can also modify the registry directly.

4. Use VB and the like to do a shell startup with parameters to start access.

The first way users are easily lost in use. Getting Started with programming (http://bianceng.cn)

The second third is actually the same, but after setting up the user in the local operation of all the databases are required to log in.

Glad recommended in the fourth kind

In fact, access itself can also be used as a shell to achieve the same effect:

Set fs = Application.FileSearch ''查找文件 
With fs 
   .LookIn = "C:\Program Files\Microsoft Office\" ''查找路径 
   .SearchSubFolders = True ''包含子文件夹 
   .FileName = "msaccess.exe" ''查找字串 
    
   If .Execute() > 0 Then 
    p = .FoundFiles(1)  ''ACCESS主程序完整路径 
    Shell p & " " & CurrentProject.Path & "\123.mdb /wrkgrp " & CurrentProject.Path & "\system.mdw", 3  ''带参数启动程序 
   Else 
    MsgBox "C:\Program Files\Microsoft Office\ 下没找到MSACCESS的程序文件,系统无法运行." 
   End If 
End With 
docmd.quit  ''退出外壳

It's all right to make the shell an MDE delivery user.

A parameter launcher statement can be changed to the following code

Shell SYSCMD (Acsyscmdaccessdir) & "Msaccess.exe" & Currentproject.path & "\123.mdb/wrkgrp" & Currentpro Ject. Path & "\system.mdw", 3

Note that if you want to write the password and username in an MDE, encrypt first, otherwise you can see the password and username with WordPad

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.