Default record locking

  • Thread starter Thread starter Opal
  • Start date Start date
O

Opal

If the "Edited Record" radial is checked on the advanced Options tab
will this prevent multiple users from editing the same record on a
form? My bound form opens to a current record, but I only want one
user at a time to edit the record. I do not want the users to create
more than one record per day. I want only one user to use the form at
a time and want to know if this option will produce the desired
results. Please let me know. Thank you.
 
Hi Opal,

That's a Yes.
If the "Edited Record" radial is checked on the advanced Options tab
will this prevent multiple users from editing the same record on a
form? My bound form opens to a current record, but I only want one
user at a time to edit the record. I do not want the users to create
more than one record per day. I want only one user to use the form at
a time and want to know if this option will produce the desired
results. Please let me know. Thank you.
 
Hi Opal,

That's a Yes.

This is not working, I still have users entering more than one record
per day. Is there anyway to lock the form to prevent others from
using it when it is in use?
 
Hi Opal,

The option is only locking the current record but it does not prevent users
from inserting new records. For Example, if user A exit the current record,
user B can now enter and edit that same record.

I believe you had post the same question before. So, if you're asking two
question about locking a record and to prevent users from entering new
records in one day....

You may need one more Field/Column and datatype can be a Yes/No or a Text.
Use the form's current event to handle the form's Allow Edits and Allow
Additions properties to set it to "No" (False) like....

'if you are use a "Yes/No" datatype in the table and have a checkbox in the
form
If yourTextBox = True Then
Me.Form.AllowEdits = False 'prevent Edits
Me.Form.AllowAdditions = False 'prevent inserting new record
Else
Me.Form.AllowEdits = True
Me.Form.AllowAdditions = True
End If

This is a sample only, may or may not work correctly to your requirement.
[quoted text clipped - 12 lines]

This is not working, I still have users entering more than one record
per day. Is there anyway to lock the form to prevent others from
using it when it is in use?
 
Hi Opal,

The option is only locking the current record but it does not prevent users
from inserting new records. For Example, if user A exit the current record,
user B can now enter and edit that same record.

I believe you had post the same question before. So, if you're asking two
question about locking a record and to prevent users from entering new
records in one day....

You may need one more Field/Column and datatype can be a Yes/No or a Text.
Use the form's current event to handle the form's Allow Edits and Allow
Additions properties to set it to "No" (False) like....

'if you are use a "Yes/No" datatype in the table and have a checkbox in the
form
If yourTextBox = True Then
Me.Form.AllowEdits = False 'prevent Edits
Me.Form.AllowAdditions = False 'prevent inserting new record
Else
Me.Form.AllowEdits = True
Me.Form.AllowAdditions = True
End If

This is a sample only, may or may not work correctly to your requirement.
[quoted text clipped - 12 lines]
This is not working, I still have users entering more than one record
per day. Is there anyway to lock the form to prevent others from
using it when it is in use?

So, the form user would check this box on entering the form?
 
Hi Opal,

It really depends on how you want the Form to Lock and to prevent inserting a
new record.

They’re many options available. For example, if the advance option for the
“Edited Record†is check, this will prevent others from editing this record.
So, you’ll need Form’s AfterUpdate event to set the “AllowEdits = No†like…..

‘set this hidden checkbox
Me.CheckBox = False

The current event of the Form will handle the other properties.


As for the “Allow only one record per dayâ€, you need set the Form’s
RecordSource to a proper query like…

“SomeDate†is the Column in the Table where the Default is set to “Date()†or
if you prefer, set it on the Form where “SomeDate†is the control.

Select col1, col2…… From Table Where SomeDate = Date()

And in the current event a code the handle if there are no records like……

If Me.RecordsetClone = 0 then
Me.AllowAdditions = True
Else
Me.AllowAdditions = False ‘do not allow insert
End If

However, the above code will not prevent two or more concurrent users
attempting to insert a new record on the same day if there are no records.

So, a simple (but not really a good one) is to save the record if the first
user starts to insert a new record.

Another is to use a scheduler to insert a record just before any user starts
using the database. This requires the database as the back end.
 
Hi Opal,

It really depends on how you want the Form to Lock and to prevent inserting a
new record.

They're many options available. For example, if the advance option for the
"Edited Record" is check, this will prevent others from editing this record.
So, you'll need Form's AfterUpdate event to set the "AllowEdits = No" like.....

'set this hidden checkbox
Me.CheckBox = False

The current event of the Form will handle the other properties.

As for the "Allow only one record per day", you need set the Form's
RecordSource to a proper query like...

"SomeDate" is the Column in the Table where the Default is set to "Date()" or
if you prefer, set it on the Form where "SomeDate" is the control.

Select col1, col2...... From Table Where SomeDate = Date()

And in the current event a code the handle if there are no records like......

If Me.RecordsetClone = 0 then
Me.AllowAdditions = True
Else
Me.AllowAdditions = False 'do not allow insert
End If

However, the above code will not prevent two or more concurrent users
attempting to insert a new record on the same day if there are no records.

So, a simple (but not really a good one) is to save the record if the first
user starts to insert a new record.

Another is to use a scheduler to insert a record just before any user starts
using the database. This requires the database as the back end.

Oh boy... I feel I am getting in way over my head here.....

This was a database I created in a couple of hours one afternoon to
replace an excel spreadsheet that cannot do what Access can do. Many
of my users are not well versed in Access and I am on a very sharp
learning curve when it comes to VBA in Access. The database was
created so that 4 separate shops could go in and enter pertinent
information about how their shops ran throughout the day so that my
boss (and theirs) could report out to his boss at the end of the day
about how things went. Each shop has its own form to enter their
information. I gave them separate forms bound to 4 separate tables
because the information gathered from each shop is unique. Each form
opens with the following code:

Private Sub Form_Open(Cancel As Integer)
DoCmd.Maximize
DoCmd.OpenForm "ShopDailyfrm", , , "txtDate = Date()"
End Sub

So that they always see each day's information and can go in multiple
times throughout the day to
add and update data / comments. The database then creates one report
containing the information
for all 4 shops that my boss uses to report out to his boss.

Problem is that there are multiple users adding information to the
tables. I have told the users within each shop that there should only
be one person in the shop specific form at a time. I have one shop
that does not always adhere to this and some days I end up with
multiple records. My hope is to prevent this by "locking-out" the
form to one user at a time. I really cannot depend on this group to
check a box upon entering the form that is why I thought by checking
the "Edited Record" radial on the advanced Options tab would elminate
multiple records, but it hasn't.

So although I read your last post, I am having trouble getting my head
around it (newbie), that is why
I wrote this rather long post so that you could better understand my
dilemma and direct me accordingly.
 
Hi Opal,

You can use the openargs also.

From what you have posted, you'll definately need a BackEnd DataBase. Unless,
you want to combine all 4 Tables by some coding, which quite impossible to do
judging by the type of data.

You'll need definately a share folder and one mechine as the server. Link
this database file to the FrontEnd.
 
Hi Opal,

You can use the openargs also.

From what you have posted, you'll definately need a BackEnd DataBase. Unless,
you want to combine all 4 Tables by some coding, which quite impossible to do
judging by the type of data.

You'll need definately a share folder and one mechine as the server. Link
this database file to the FrontEnd.

Unfortunately, in a multi-user environment (3000+ users) but only a
dozen
or so using this specific database located on a shared network drive,
what
you are suggesting would not be an option my I.S. Department would
entertain.

Someone else has suggested that I check the "All Records" radial
instead
of just the "Edited Records" radial in the Advanced Options tab. I am
going to
try this option and see if it helps. Thank you for your assistance.
 
Hi Opal,

Hopefully that works for you, but the user still can insert a new record and
you’ll still have more than one record per day.

I don’t want to suggest this but if the users are in the same Subnet (i.e
they network together as one group) you’re in luck. You don’t really need a
Server as one of the user PC can act as the main database. May not be safe as
others in the same network might delete or steal the database.
 
Back
Top