Login into Access

billmark

Registered User.
Local time
Yesterday, 17:08
Joined
Mar 28, 2012
Messages
25
Hi
I have created an access program with user id and password to login. I want to restrict only one user at one time. Please advise how to write vba or any way:
1.to prompt a message that someone is using when other use try to launch the program
2.to show the login id in this message
3.no login form prompted so that other user can't login.

Regards
 
Don't use a split database. Only 1 user can be in it.
 
Don't use a split database. Only 1 user can be in it.

that's not true. you would need to open exclusive to have one user only.

I would actually store the active user in a table somewhere, and close the database if the table was not empty.

You would still need a utility to clear the table if it didn't clear properly.
 
another approach, somewhat same with Dave, split the db:

create a public function in a module, then call this in autoexec macro

public gObjDatabase As Dao.Database
public function fnCheckDatabase()
dim ws as dao.workspace
set ws = dbengine(0)
on error resume next
set gObjDatabase = ws.Opendatabase("the path and name of BE", True, False)
if err.number <> 0 'cannot open exclusively then it is already opened by someone
msgbox "Database already in use!"
'quit the application
DoCmd.quit
else
' your login form here
end if
end function
di
 
Thank.
I am not familiar to split the database.
As mentioned by using the public function, do I need to split the db or just create a public function.
What does it mean "the path and name of BE"? do I need to modify this?

Regards
 
@billmark

given your last post, which probably demonstrates that you are new to access - the question is why do you want the solution you asked for in your original post.

One great advantage of access is that, unlike excel, which only allows one active user at a time, access allows multiple users by default. Why are you trying to prevent that particular benefit?
 
Hi
Access allows multiple users by default and my concern is when some users (eg more than 3) at the same time are using the input form to update the table, will it be any impact on updating the data? My table has a primary key. Also, if they click the same button to run the report, will the program be crashed. Hope to clarify.
 
Access protects it's data, and there shouldn't be any issues.

note that our recommendation is

a) split the database into a front end and back end.
b) give each user a personal copy of the front end.

You may be able to have multiple users sharing the same copy of the front end, but from personal experience, we don't recommend it.
 

Users who are viewing this thread

Back
Top Bottom