where to put "allowedits = false"

R

Ray

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.
 
K

Ken Snell \(MVP\)

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
 
R

Ray

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?
 
R

Ray

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top