Toggle off data entry on a field

  • Thread starter Thread starter Geoff
  • Start date Start date
G

Geoff

Is it possible to set a field in a form so that it accepts
data entry, but only until a different Yes/No field on the
same form is clicked to Yes, after which the original
field would refuse to accept changes?

Many thanks,
Geoff.
 
Use the Current event of the form to prevent further edits.

Private Sub Form_Current()
Dim bAllow as Boolean
bAllow = Not Nz(Me.[NameOfYourYesNoFieldHere].Value, False)
Me.AllowEdits = bAllow
Me.AllowDeletions = bAllow
End Sub
 
Geoff said:
Is it possible to set a field in a form so that it accepts
data entry, but only until a different Yes/No field on the
same form is clicked to Yes, after which the original
field would refuse to accept changes?

If you only want to prevent changes to a single control,
then use both the Current event and the YesNo checkbox's
AfterUpdate event to Lock the textbox:

Me.thetextbox.Locked = (Me.thecheckbox = True)
 
Back
Top