how to display a message when current record is locked?

M

Marco

how can I put a message when current record is locked?

sometimes users don't realise that the record is already being used so I
think that a message alerting them was perfect.

How can i do this?

Regards,
Marco
 
A

Al Campagna

Marco,
What method are you using to "Lock" the record?
If some property, or form value, denotes "locked", the use the OnCurrent
event of the form to examine that property or value, and post the Locked
message when applicable.

Ex. OnCurrent (aircode, using a form value)
If Me.LockStatus = "Locked" Then
' MsgBox here "Locked"
End If
OR...
Ex. OnCurrent (aircode, using form property)
If Forms!frmYourFormName.Form.AllowEdits = False Then
' MsgBox here... "Locked"
End If

--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 
D

DanRoss

The "database" engine takes care of that type of locking on it's own and
it's pretty much transparent - however - if that conflict does occur the DB
engine will raise an error to the user.

You can repro by creating two simple queiries against the same table.
Open one query and edit the field (dont' save)
Open the other and edit the same field and save
go back to the first recrod and attempt to save and you'll get a write
confilict error. . .

If that's enough then no worries - let the db engine do it's work. However,
I had a situation where I had form data that multiple users could work on -
My solution was to create a tracting table. My forms included events to
maintain the table so that if a user opened a form and clicked "Edit" an
entry was entered into the table that identifed the user and the data being
edited. If another user attempted to click edit - it would check for the
tracking table, find that another user was working on that records and alert
the second user that the record was being modified by user name, record id,
time, other relevant info to my project.

This worked well and was eventually ported over to a APS web project.
Bottom line is if you want functionality to manage that type of activity -
you need to think through the work flow scenarios you'll encounter and build
it in.

Food for thought.
 
A

Al Campagna

Marco,
Your reply gives us no information at all.
We still don't know what method you are using to Lock the records. And
consequently, what method we'll need to "unlock" the records.

You wrote...That tells us nothing...
What errors?

How can we assist you without seeing your code. Cut & Paste your code
"exactly" in your replies.

Note: The "aircode" (or pseudo code) I suggested, is just an shorthand
example of the code to unlock a record. It is not exact, and does not
represent the actual syntax you'll need to unlock your record.
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 
Top