Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

auto restart of access

Status
Not open for further replies.

MJD1

Technical User
Jul 18, 2003
134
CA
Hi all, need some help with something that seems to me very basic, but for some reason I just can't get it working. Im using access 2003 and I have part of this code in my password page. essentially, if the person logging in is not an admin, I want the program to restart with minimal menu and no editing options. For some reason, when it restarts, i get an error message telling me that the "The command line I used to start microsoft Access contains an option that MS access does not recognize"
I also get an error message for the CurrentDb.name.

If Restart Then
'Close database and re-open
stAppName = "MSACCESS.exe " & CurrentDb.Name
Call Shell(stAppName,1)
DoCmd.Quit

I know I can use the security tool built into Access, but found that this was a better option for my application.

thanks in advance
Martin
 
ok, so when I remove "& CurrentDb.Name" it closes and restarts Access without the error messages.
I just need to understand how to automatically start my database file.


 
When I keep CurrentDb.Name I get an error message telling me that MS Access can't find the file C:\Documents.mdb. My file name casemanagementsystem.mdb.

thx
Martin
 
Here is what I get when I typed CurrentDb.Name in a window:

C:\Documents and Settings\mdempsey\My Documents\CMS\Casemanagementsystemwin2003.mdb

so, I created a new foder named CMS at c:\ and now I don't get the error messages however, access re-opens but doesnt open the mdb file.

 
my mistake, I still get the error message telling me it can't find the database.

any suggestions?
 
I expect one issue is all the spaces in the folder names. You would have to compensate for this by add quotes. Try something like:
Code:
If Restart Then
        'Close database and re-open
        stAppName = "MSACCESS.exe """ & CurrentDb.Name & """ "
        Call Shell(stAppName,1)
        DoCmd.Quit
End If
You may want to take a look at the free utility from Michael Kaplan SOON at
Duane
Hook'D on Access
MS Access MVP
 
Thanks Duanne, the added quotes did the job! also, thanks for the utility link, very interesting.

martin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top