By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,985 Members | 1,777 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,985 IT Pros & Developers. It's quick & easy.

Single user access...

P: 4
Hi

Is there someone who know an easy way, so only one user can access a MS Access db without using users/groups in the database? It should be done by only knowing that someone is logged in/or opening the database?

I have made a part of a solution with a little login-screen and you only provide your initials and when click "Login" and when I execute the following sql:

strSQL = "Insert into login_info (Login,CurrentUser, loggedIn) Values ('" + Txt_login.Value + "','" + FindUser.fOSUserName + "',1);"

CurrentDb.execute strSQL

But before a user can login to the application I have to check if there is already one user who have the flag "LoggedIn" set to 1 (Yes).
After the User is finished using the application there should be an update statement where the flag "LoggedIn" is set to 0...

I have two problems/questions:
1) How do I make the check for the flag... I'm new to MS Access and have read a lot, but I can't really find a way to open the recordset with the sql (select * from login_info where LoggedIn = 1) and check the field "LoggedIn" in some If... then... else sentense...

2) Is there some other way to make a MS Access database work in single user mode? Maybe some way to set some kind of isolation level to the database or table access... ex. writing some code in the private sub form_open(Cancel as Integer)...?

The most important in my application is that only one user can log in and write to the application and all other user should have a message that someone else is editing...


Regards
Mar 13 '07 #1
Share this Question
Share on Google+
7 Replies


MMcCarthy
Expert Mod 10K+
P: 14,534
Have a look in the Tools menu for Options. Under the advanced tab set the Default Open Mode to Exclusive rather than shared. This means once a user is on the database other users can only open it as a Read Only file.

Mary
Mar 13 '07 #2

P: 4
:o) Thanks, it should do it - must have missed it when I was looking...
Mar 13 '07 #3

MMcCarthy
Expert Mod 10K+
P: 14,534
:o) Thanks, it should do it - must have missed it when I was looking...
No problem.
Mar 13 '07 #4

P: 4
Oh, I was maybe a little too fast...

Now i've tested on 5 different PC's with different users logged on. I have discovered that the exclusive flag is not set by default but is something set per installation. It's the same with the flags under Tool-->options-->view...

I need a way to get single user access to the database or tables in the database for every user / PC that opens the database regardlees of the installation or usersetup....

Is it possible to set those parameters when I open a form?
(Couldn't find them in help...)
Mar 16 '07 #5

MMcCarthy
Expert Mod 10K+
P: 14,534
Are you distributing the frontends as mde files?
Mar 16 '07 #6

P: 4
Are you distributing the frontends as mde files?
No, I have only a single mdb-file... Is it only possible to make exclusive access when I separate the frontend?
Mar 16 '07 #7

MMcCarthy
Expert Mod 10K+
P: 14,534
No, I have only a single mdb-file... Is it only possible to make exclusive access when I separate the frontend?
Standard practice would be to separate the frontend and backend. Then you only need to set the options on the backend and can have multiple frontends.

Mary
Mar 16 '07 #8

Post your reply

Sign in to post your reply or Sign up for a free account.