where to put "allowedits = false"

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

Guest

I have a form in which I want to set 'allowedits = false' if the record is
over 1 day old. I also have a hidden control that management can press to set
'allow edits = true'.

Which is the best of the form's events to use so that if the record is over
1 day old the 'allowedits = false' will be done. I want it to function only
when it moves to another record. If I use "on Current" event, the it will set
'allowedits = false' as soon as I press the hidden control to set 'allowedits
= true'.

I have the code. I just need to know in which of the form's events to put it.
 
The form's Current event is the right event. What you need to do is revise
how you make the "management" option work. Put a hidden textbox on the form
(name it txtManagement). Have the form's Load event procedure set the value
of this textbox to 0 (which is the value for False constant). Then code the
"management" hidden control to change the value of this textbox to -1 (which
is the value for the True constant). Then in the form's Current event, use
this code:

Me.AllowEdits = Me.txtManagement.Value
 
Does the Load event refer to whenever the form moves to a different record?
If so can I use something like

Iff (Now() - me.timestamp > 1.0, me.txtmanagement = -1, me.txtmanagement = 0)

in the form's Load event?
 
I got it. Thanks. Put the IIf in the oncurrent. That will not allow edits it
at the change of records and the control can allow edits until it moves to
another record.
 
Back
Top