Toggle off data entry on a field

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

Allen Browne

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
 
M

Marshall Barton

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)
 

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

Similar Threads


Top