Want One User Only On Form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi there everyone! Using A02 on XP. Not a programmer but learning VB and
loving it.

I have a form that is opened from the AutoExec MainForm. I would like to
have the OnClick OpenForm event tell you that the form is already in use and
try again later. What is the best way to identify that a form is currently
opened by someone else? OnGotFocus? OnOpen?

Thanks in advance for any help or advice!
 
Bonnie

How is it that you could have more than one user using the same form
simultaeously? I'll have to assume that you have a "shared" application,
and more than one user is trying to use the same file at the same time.

A reasonable (and often preferred) approach is to split your database
application into a back-end component (only the data/tables), and a
front-end component (everything else). The back-end gets placed on the LAN,
and a copy of the front-end is placed on each/every user's PC. This way,
there is no fighting over who gets to use a form.

Regards

Jeff Boyce
<Office/Access MVP>
 
What are you trying to _accomplish_? It is a bad idea to have multiple
people logged in to the same front end (queries, forms, reports, macros,
modules) or monolithic database (those plus tables, relationships, and data)
because it significantly increases the probability of corruption.

Appropriate multiuser configuration would be for each user to have his/her
own copy of the front end, linked to a database containing the tables,
relationships, and data residing in a shared folder on the server.

Larry Linson
Microsoft Access MVP
 
Hi Jeff, I already have the front-end/back-end DB going. Have to use shared
front-end DB's because I do not know how to deploy to 70 desktops so we have
front-end DB's in a shared drive folder. No time to go to 70 desks everytime
I make edits or changes to reports or forms in my DB's.

In this inquiry I just have a little side DB that is used to
import/reconfigure/export data. I have 4 processes that can run and want to
limit usage so someone doesn't 'use' one of the processes while someone else
has their data running through it. I just need to know how to let someone
know that someone else already has the form open. Can you answer?
 
Hi Larry, I already have the front-end/back-end DB going. Have to use
shared front-end DB's because I do not know how to deploy to 70 desktops so
we have front-end DB's in a shared drive folder. Cannot go to 70 desks
everytime I make edits or changes to reports or forms.

In this inquiry I just have a little side DB that is used to
import/reconfigure/export data. I have 4 processes that can run and want to
limit usage so someone doesn't 'use' one of the processes while someone else
has their data running through it. I just need to know how to let someone
know that someone else already has the form open. Can you answer?
 
Bonnie said:
Hi Larry, I already have the front-end/back-end DB going. Have to
use shared front-end DB's because I do not know how to deploy to 70
desktops so we have front-end DB's in a shared drive folder. Cannot
go to 70 desks everytime I make edits or changes to reports or forms.

It is trivial to create a system that will automatically deploy changes to the
FE to all users.

Tony Toews created a free utility that does this only when the FE has been
changed.

I've written my own such "Version Checker" using another MDB file that the user
launches and it updates the "real" application file under certain circumstances
before opening it.

Updates can be pushed to the users PCs using their network logon script.

If your MDE is not too large you can just use a batch file that replaces the MDE
with a new copy every time it is used.

A large chunk of the advantages to a split design are lost when you have
everyone use a common FE file. Take an hour or so and set up a proper system.
You won't regret it.
 
Thanks Rick. I will make a note to look into finding info on Mr. Toews FE
updater. Is yours available for sharing? If so, where? Just learning VB
and have no clue what is or where to find a 'batch' file. What language?
JS? .bat? Rings a bell. Please remember, something so 'trivial' to you can
appear to be a huge mountain to others. If you could give me a few places to
check (does Mr. Toews have a website?) I'll give it a go after my year end
crunch. Thanks again for taking time to help folks like me. Happy New Year!
 
Bonnie said:
Thanks Rick. I will make a note to look into finding info on Mr.
Toews FE updater.
http://www.granite.ab.ca/access/autofe.htm

Is yours available for sharing? If so, where?

Mine is highly customized so I don't make a copy available anywhere.
Essentially my app's shortcut actually opens VersionChecker.MDE rather than the
actual application's MDE file. The version checker compares a version number in
a local table of the application MDE against a version number in the back end
database. If the user's version is not current then I use FileCopy to replace
the local file and then open that file, then close the VersionChecker file.

That is over-simplified. I actually have lots of ways to trigger an update for
the user and this allows me to make updates that only affect certain users
rather than ALL users, but it would be easy to implement the basic structure as
outlined.
Just learning VB and have no clue what is or where to find a 'batch'
file. What language? JS? .bat? Rings a bell.

Yes, a plain old DOS style bat file with command to copy a file from a spot on
the network to the user's local drive.
 
Thanks Rick. I will make a note to look into finding info on Mr. Toews FE
updater. Is yours available for sharing? If so, where? Just learning VB
and have no clue what is or where to find a 'batch' file. What language?
JS? .bat? Rings a bell. Please remember, something so 'trivial' to you can
appear to be a huge mountain to others. If you could give me a few places to
check (does Mr. Toews have a website?) I'll give it a go after my year end
crunch. Thanks again for taking time to help folks like me. Happy New Year!

To give a solution to your original question about how to prevent more
than one user access to a form, you could put a 'system' table in the
backend, with a boolean field for the form name. In the form open
event, test the value of this field. If false, set it true else
cancel the open event, and in the form close event. set the value of
the field to false

P
 
Back
Top