Re: Unlocking problem...



Try this:

1. Put the stuff in the action event in a switch - only one action happens at a time, but if you use if blocks, they are all checked - use a switch.

2. In the second bunch, do this

case eventInfo.id() = DataArriveRecord :
if not isEdit() then
edit()
endIf
doDefault ;// **
ViewedOn.value = today()
ViewedOn.unlockRecord() ;// ***


** I rarely recommend this, but it seems the best option in this situation. This may well fix the problem entirely - you're probably trying to write to the field before the arrive is complete enough to allow it and it's probably another record that's already locked...

*** Unless the ViewedOn field is part of the current index and/or there's a validity check that hasn't been met, this should be fine. If it's part of the current index, try dropping this line and see what happens. If there are validity checks which might not have been met yet, then you'll have to decide what to do - try without this line, put it in a try block and in the onFail you can either do errorClear() (the record stays locked) or something else (post, pop an error, cancel your edit, whatever - it depends on your needs).

Liz


Kenneth wrote:

;// This code executes only for the form:

if eventInfo.id() = DataPostRecord or
(eventInfo.id() = DataUnlockRecord and
active.RecordStatus("Modified")) then
ModDate.value = today()
endIf

;// following added:

if eventInfo.id() = DataArriveRecord then
ViewedOn.value = today()
endIf
.



Relevant Pages