Data Entry Lock Out

G

Guest

I have a data entry form with several combo boxes, text boxes, ect. For one
of the combo boxes, if "NONE" is selected, i wanted to know how to restrict
data input (gray out) all other fields on the form to restrict data input.
How can I do this?

thank you,
 
B

Brian Bastl

Use the combo's AfterUpdate event procedure

If Me.MyCombo = "NONE" Then
Me.SomeControl.Enabled = (Me.MyCombo <> "NONE")
Me.SomeOtherControl.Enabled = (Me.MyCombo <> "NONE")
End If

You'll probably need to copy this also to the form's On Current event
procedure.

HTH,
Brian
 
B

Brian Bastl

Sorry, I had two separate ideas in my head and got in a hurry. It should be
one or the other:

If Me.MyCombo = "NONE" Then
Me.SomeControl.Enabled = False
End if

Or better still:

Me.SomeControl.Enabled = (Me.MyCombo <> "NONE")
Me.SomeOtherControl.Enabled = (Me.MyCombo <> "NONE")

Brian
 
G

Guest

This worked great, exactly what i wanted. however, once a user wishes to
input a "NEW" record, the fields are still locked out. Is there an option to
break up the loop?

thanks,
 
B

Brian Bastl

So which one did you use? OptionA or OptionB?
If you used the If/ End If approach, then the following using the form's On
Current event procedure should work:

Private Sub Form_Current()
If Not Me.NewRecord Then
Me.SomeControl.Enabled = (Me.MyCombo <> "NONE")
Else
Me.SomeControl.Enabled = True
End If
End Sub

Otherwise, if you used the second example, then you'd use the exact same
code for both the form's On Current event and the combo's After Update:

Me.SomeControl.Enabled = (Me.MyCombo <> "NONE")
Me.SomeOtherControl.Enabled = (Me.MyCombo <> "NONE")

HTH,
Brian
 

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