Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 1 / March 2006

Tip: Looking for answers? Try searching our database.

Have form only open for one user at a time.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
rdemyan - 13 Mar 2006 00:08 GMT
My application is split into a front end and back end. Each user has their
own copy of the front end.

There are a few forms I only want to be open for one user at a time. So I've
implemented the following strategy:

1) Create a table with the fields FormName, OpenStatus, FormUser
2) When a user tries to open the form, the code in the Form Load event checks
the table for the OpenStatus value (True/False).
3) If the status is True, then someone else has the form open on another
machine and this user cannot open the form. A BypassCloseFlag is set and then
DoCmd.Close for the form is executed. The BypassCloseFlag prevents execution
of the code in step 5 below.
4) If the status is False, then the table record is updated to FormUser =
CurrentUser ande OpenStatus to True.
5) In the Form Close event, there is code to set OpenStatus to False and
FormUser to spaces as long as ByPassCloseFlag is not set to true.

This is all working fine, but I have the following concern.

What if the system crashes while this form is open and the user cannot close
it in a normal fashion which sets the table field for OpenStatus to False.
Subsequently, isn't there the potential that OpenStatus could remain set to
True with no one being able to open the form at all.

My users do not have any direct access to tables because I have locked down
the app using the startup options. Also, no user has direct access to the
backend file so it can't be opened.

Someone might suggest try it and see what happens. However, I don't wnat to
crash my system on purpose for testing. I might try it after I've implemented
something that I've been reasonably assured will work. But crashing the
system on purpose makes me nervous.

I guess I could include a form for the administrators to be able to reset the
OpenStatus to false for all form names in the table, but I wanted to see if
someone else has a suggestion.

Thanks.
Bob Quintal - 13 Mar 2006 00:35 GMT
> My application is split into a front end and back end. Each
> user has their own copy of the front end.
>
> There are a few forms I only want to be open for one user at a
> time. So I've implemented the following strategy:

WHY????????
Access is very good at handling concurrent users. Access also
supports exclusive mode.      

> 1) Create a table with the fields FormName, OpenStatus,
> FormUser 2) When a user tries to open the form, the code in
[quoted text clipped - 16 lines]
> potential that OpenStatus could remain set to True with no one
> being able to open the form at all.

Right.

> My users do not have any direct access to tables because I
> have locked down the app using the startup options. Also, no
[quoted text clipped - 6 lines]
> reasonably assured will work. But crashing the system on
> purpose makes me nervous.

It should make you nervous. but you could test on a copy of BE
and copy of FE and just kill Access using the task manager.

> I guess I could include a form for the administrators to be
> able to reset the OpenStatus to false for all form names in
> the table, but I wanted to see if someone else has a
> suggestion.

Yes. Create a macro that resets the flag. You can then start the
application using the command line to run the macro.  

> Thanks.

Signature

Bob Quintal

PA is y I've altered my email address.

david epsom dot com dot au - 13 Mar 2006 00:50 GMT
You should have a form for admin reset.

You should also include a date/time field
so that you can see when the record was last
set.

You may also wish to include a computer name field,
so that you can see which workstation the user
is/was at.

You can also use ADO to check the user roster to
see if the user who has the form locked is still
connected, but that will have the same failing:

If the user crashes without disconnecting, the
user roster maintained by Jet will have the same
error as you do.

> My application is split into a front end and back end. Each user has their
> own copy of the front end.
[quoted text clipped - 46 lines]
>
> Thanks.
BillCo - 13 Mar 2006 11:35 GMT
there's always a risk when you are using a semiphore to control access
to an object that if it crashes you'll be left with it in a permamently
locked state. The only full solution is to establish proper client
server communication - not easy to replicate with Access FE / BE.

The way I see it, you have 2 real options
1. Create an admin panel and give one user re-setting abilities
2. Look at your DB design - you should not have to lock users out of a
form for exclusive editing... Access can handle concurrent updates
quite well and there is probably a more workable design that can be
employed. (unless you're taking orders from one of those control freak
user clients that don't know what they are talking about - man I hate
that sh!t!!!)
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.