The Shell command allows you to run external programs. You will need
to know the path for the Access 2000 executable. It is called
msaccess.exe. If you have more than one version installed, you will
find more than one file by this name. One way to make sure you have
the right one is to look for the one with Access2000 logo (purple key
in a box) rather than the Access97 logo (yellow key).
Once you have this path, you can use Shell to open your database.
Public Sub StartAccess2000()
Shell "C:\Program Files\Microsoft Office\Office\msaccess.exe"
End Sub
Shell simply runs a command line, so you have access to the same
command line arguments and switches as you have from anywhere else.
For example, by passing the name of your database on the command line,
you can have Access automatically open that database.
Public Sub StartAccess2000WithDb()
Shell "C:\Program Files\Microsoft Office\Office\msaccess.exe
c:\mydb.mdb"
End Sub
Shell also takes an optional argument for windowstyle. To
automatically set the focus to the new window, use vbNormalFocus.
Public Sub StartAccess2000WithDbAndFocus()
Shell "C:\Program Files\Microsoft Office\Office\msaccess.exe
c:\mydb.mdb", vbNormalFocus
End Sub
A full description of Shell and its arguments can be found in the Help
for Access 97.
Good luck with your database!
Hammer |