Locking a record with "options groups"

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

Guest

I have an "Option Group" in a form that sets a value "closed" to true or false. Is there a way to havve it lock the record from and further updates when closed is set to true (-1)

thank yo
BT
 
In the form's BeforeUpdate eventhandler, check the OldValue
property of the "Option Group" for -1 and if so, cancel the
update.

Hope This Helps
Gerald Stanley MCSD
-----Original Message-----
I have an "Option Group" in a form that sets a value
"closed" to true or false. Is there a way to havve it lock
the record from and further updates when closed is set to
true (-1).
 
Thanks Gerald

great idea

I have a couple of questions thoug
Can this be done with an expression or does it require coding? (I have a couple books on order, but don't know VBA yet
Would this need to be done for all forms that may update the record or is there a way to apply it directly to the the table entry

Thanks agai
B
 
It can only be done by coding and would have to go into
every form where the data could be updated. The code is
short e.g.

If {yourOptionGroupName}.Value = -1 then
Cancel = True
Exit Sub
End If

The only thing you need to change is {yourOptionGroupName}
including the {}. If you have not put code in before, the
simplest way is
1- Open The Form in Design View
2- Click on the Properties Icon. It should list the Form
properties automatically but if it doesn't then slect Form
from the dropDown.
3- Click on the Event tab
4- Click into the 'Before Update' entry, then click on the
'...' that appears to the side of the text box. That
should take you into the VB editor.
5- Enter the code as shown, then click on File->Close
6- Save the Form and give it a try.

Hope This Helps
Gerald Stanley MCSD
-----Original Message-----
Thanks Gerald,

great idea!

I have a couple of questions though
Can this be done with an expression or does it require
coding? (I have a couple books on order, but don't know VBA
yet)
Would this need to be done for all forms that may update
the record or is there a way to apply it directly to the
the table entry?
 
Back
Top