Prevent another user accessing a form while its already in use

Steve_T

Registered User.
Local time
Today, 15:53
Joined
Feb 6, 2008
Messages
96
Hello,
I have created a Database to be used to add a holidays, the problem is that due to the large amount of users i need to prevent another user accessing a form via a command button on the main screen that opens when the database is accessed.
I would be greatfull for any suggestions or help as its much needed.
 
this shouldnt arise as a problem, really

each user should have their own copy of the dbs, and you should split the front end and back end
 
How many people enter data? If only a few, you could do something like the following as long as you are on a network and each person has a unique username:

Dim strUsername As String

strUsername = lcase(Environ("UserName"))

If strUsername = "user1" or strUsername = "user2" or strUsername = "user3" Then

cmdButtonName.Visible = True

Else

cmdButtonName.Visible = False

End If


cmdButtonName being your command button of course.

Won't work that way if people use the same database on the same system without logging into it with their own username. If that's happening you should have some sort of login form which can set access levels and make the button visible/invisible based on that.
 
this shouldnt arise as a problem, really

each user should have their own copy of the dbs, and you should split the front end and back end

But if you want some users to be able to get to it, and some not, you're not going to make different versions of the front end. And then because that version could just be copied to someone else.
 
this shouldnt arise as a problem, really

each user should have their own copy of the dbs, and you should split the front end and back end

Hi thanks for reply, the reason why i need to restrict access to one person at a time is to prevent the same date being booked of at the same time. One a booking is made and the table updated this can not happen but need to prevent two people doing it at the same time
 
How many people enter data? If only a few, you could do something like the following as long as you are on a network and each person has a unique username:

Dim strUsername As String

strUsername = lcase(Environ("UserName"))

If strUsername = "user1" or strUsername = "user2" or strUsername = "user3" Then

cmdButtonName.Visible = True

Else

cmdButtonName.Visible = False

End If


cmdButtonName being your command button of course.

Won't work that way if people use the same database on the same system without logging into it with their own username. If that's happening you should have some sort of login form which can set access levels and make the button visible/invisible based on that.

This is exactly what i need, all the users have their own windos desktop so it will work. The above code, am i right to assume i assign this to the button used to access the Foem in question? Also do i need to add or create anything else?
 
a couple of other possiblilites are

you could use a control flag in a table to indicate that someone has the form open, and not open in that case

you could use access security hide certain firms form certain users

------
you definitley do not want to be making different versions for each user.
 
Steve - that code should be in the On Load event for the form, so that when it opens it either shows or hides the button then. That way, the people who aren't supposed to see it don't even know it's there in the first place.
 

Users who are viewing this thread

Back
Top Bottom