record lock message on sub form

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

Guest

is there anyway to display a pop up window or msgbox when a record is locked at the sub form level
i am developing an application for a client using windows 97 and when multi people are going for the same
record i do not get notification. the record is locked but no one knows why. hence, the need fo
a pop up window or msgbox.
 
what you can do - is to try to lock record, if error - then record already
locked

--
Alex Dybenko (MVP)
http://Alex.Dybenko.com


jn said:
is there anyway to display a pop up window or msgbox when a record is locked at the sub form level?
i am developing an application for a client using windows 97 and when
multi people are going for the same
 
hi, i need a little more information as to how can do that

i have record locks set to edited record. i have the back end file on a server and mde fil
on the workstation. when 2 or more users fetch the same record, there is a lock out, just no message

all toolbars, record locators have been eliminated to prevent any user intervention on the code.
 
if you have a form then:

dim rst as dao.recordset
set rst=me.recordsetclone

on error resume next
rst.edit
rst!<SomeName>=rst!<SomeName>
rst.update
if err <>0 then
msgbox "record is locked!"
end if

--
Alex Dybenko (MVP)
http://Alex.Dybenko.com



jn said:
hi, i need a little more information as to how can do that.

i have record locks set to edited record. i have the back end file on a server and mde file
on the workstation. when 2 or more users fetch the same record, there is a lock out, just no message.

all toolbars, record locators have been eliminated to prevent any user
intervention on the code.
 
i keyed the code at the sub form level, placing it at before update one time, and the second at
on activate
each time it locked every record in my test database.
i have a patient data base where the main form has the demographics and subform has al
the visits for the patient
when a record is locked, i only want to lock the particular visit the user has retrieved

so am i putting the code in the wrong place?
 
What if it's an autonumber? :-)

TC


Alex Dybenko said:
if you have a form then:

dim rst as dao.recordset
set rst=me.recordsetclone

on error resume next
rst.edit
rst!<SomeName>=rst!<SomeName>
rst.update
if err <>0 then
msgbox "record is locked!"
end if

--
Alex Dybenko (MVP)
http://Alex.Dybenko.com



a
lock out, just no message.
intervention on the code.
 
sorry, need a little more info regarding this suggestion


jn, please include the text of the previous post, when you reply. This is
because the previous post might have disappeared from the reader's
newsserver. When I read your sentence above, I had literally no idea what it
was about. I had to search back through old posts, to see what you were
replying to. That was not a productive use of my time :-)

My comment was on Alex's code:
on error resume next
rst.edit
rst!<SomeName>=rst!<SomeName>
rst.update
if err <>0 then
msgbox "record is locked!"
end if

His suggestion is fine, with one exception. He is assuming that >any< error
from the rst.update, means that the record is locked. But that is not a safe
assumption. For example, autonumber fields can not be edited, so they will
return an error on the rst.update, regardless of whether the record is
locked >or not<. So I was pointing out to him, somewhat cruptically, that he
should check the error code before he concludes that the record is locked.

Somehing like:

rst.update
select case err.number
case 0 ' no error.
case 1234: msgbox "record is locked!"
case else ' some other error occurred.
end select

Of course, the proper number is not 1234. You'd have to find out the right
number (I don't have Access here to check).

HTH,
TC
 
Back
Top