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