![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
#3
| |||
| |||
|
|
when certain other code fires on the form, I get the error that the record is already locked for this session. |
#4
| |||
| |||
|
#5
| |||
| |||
|
|
;// 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 |
#6
| |||
| |||
|
|
Howdy, Originally, I had code on a form to enter today() in a field called ModDate when something in the underlying tables was modified using the form. That code looked like this, and worked fine: ;// This code executes only for the form: if eventInfo.id() = DataPostRecord or (eventInfo.id() = DataUnlockRecord and active.RecordStatus("Modified")) then ModDate.value = today() endIf |
#7
| |||
| |||
|
|
Hi again, Well, I am having a problem with this after all... I have a field called "ModDate" that shows today() if there is any modification to any field on the form. I also have a field called "Viewed" that shows today() if a record is viewed, whether or not anything is modified. Of course, I would not want ModDate to change if there is no modification to the record, but now, because of the change to the "Viewed" field, ModDate also changes. I assume that I can modify the "ModDate" code so that it "ignores" changes to the "Viewed" field, but I don't know how to do that. Here is the ModDate code from the action event of the form: method action(var eventInfo ActionEvent) var endVar if eventInfo.isPreFilter() then ;// This code executes for each object on the form: if isEdit() then if eventInfo.id() = DataRefresh then eventInfo.setErrorCode(UserError) endIf endIf else ;//This code executes only for the form: if (eventInfo.id() = DataPostRecord and active.RecordStatus("New")) or (eventInfo.id() = DataUnlockRecord and (active.RecordStatus("Modified") or active.RecordStatus("Locked"))) then ModDate.value = today() endIf endIf endMethod Can you suggest the modification I need? Sincere thanks, |
#8
| |||
| |||
|
|
Hi Liz, I just put this on the arrive of the field where I had the other code: method arrive(var eventInfo MoveEvent) var tc1 tCursor endVar if not tc1.open (" ATA: demograf.db") then errorShow()endIf if not tc1.edit() then errorShow() endif tc1.Viewed = today() if not tc1.endEdit() then errorShow() endif endMethod It generates no error, but it does not write today's date to the table. What am I missing? Thanks, |
#9
| |||
| |||
|
|
Um, moving to the right record? Try tc.attach(UIObject). |
#10
| |||
| |||
|
|
Hi Liz, Of course, that is the problem, but I need some further help. I can't figure out how to make the attach work properly. Should I be attaching the tCursor to the form or to something on the form? I've read the appropriate help file entry, but don't get it. Thanks again, |
![]() |
| Thread Tools | |
| Display Modes | |
| |