First, thank you Alex for providing the link. Now the bad news... this
method doesn't work. When using ShellExecute to open an mdb, the parameter
is ignored. I was trying to prepare a simple example and realized that this
was the problem that I had when I originally tried this. You can use Shell
and it does work but it's a pain to get the syntax right. Here is an example:
Sub RunUpdate()
Dim Update_DB_FilePath As String
Dim FE_DB_filename As String
Dim CommandLine As String
Dim ReturnCode As Long
Update_DB_FilePath = "\\servername\foldername\Update.mdb" 'path to update file
FE_DB_filename = CurrentDb.Name
CommandLine= Chr$(34) & Application.SysCmd(acSysCmdAccessDir) &
"msaccess.exe" & Chr$(34)
CommandLine = CommandLine + Chr$(32) & Chr$(34) & Update_DB_FilePath &
Chr$(34)
CommandLine = CommandLine + " /cmd " & Chr$(34) & FE_DB_filename & Chr$(34)
ReturnCode = Shell(CommandLine, vbNormalFocus)
If ReturnCode = SUCCESS Then 'I don't know the correct value
DoCmd.Quit 'close calling app to allow updates
Else
MsgBox "Unable to perform updates"
End If
End Sub
You then use the 'Command' function to return the value passed with /cmd
when launching Microsoft Access. This value will be available until you
close Update.mdb unless you change it manually
Click Tools>Options>Advanced>Command-line arguements
read via code.
Calling_FE_DB = Command() 'read the value
Best of luck,