Need help applying condition to form field.

  • Thread starter Thread starter morenoda
  • Start date Start date
M

morenoda

I am trying to apply a condition to a field where if a
certain choice is chosen the subsequent fields would be un-
editable. What is the procedure to apply the condition? I
have tryed messing around with Macros, and searched high
and low through tutorials and books. Having trouble.

Derek
 
Derek-

In both the Current event of the form and the AfterUpdate event of the
control that contains the conditional field, check the value in code and set
the Locked property of the remaining controls accordingly. This is much
easier to do in VBA than with a macro. Let's say the name of the text box
containing the condition field is txtConditionField and you want to lock a
control called txtOtherField if the condition field is > 10. In VBA, it'll
look like:

If Me.txtConditionField > 10 Then
Me.txtOtherField.Locked = True
Else
Me.txtOtherField.Locked = False
End If

--
John Viescas, author
"Microsoft Office Access 2003 Inside Out" (coming soon)
"Running Microsoft Access 2000"
"SQL Queries for Mere Mortals"
http://www.viescas.com/
(Microsoft Access MVP since 1993)
 
-----Original Message-----
Derek-

In both the Current event of the form and the AfterUpdate event of the
control that contains the conditional field, check the value in code and set
the Locked property of the remaining controls accordingly. This is much
easier to do in VBA than with a macro. Let's say the name of the text box
containing the condition field is txtConditionField and you want to lock a
control called txtOtherField if the condition field is > 10. In VBA, it'll
look like:

If Me.txtConditionField > 10 Then
Me.txtOtherField.Locked = True
Else
Me.txtOtherField.Locked = False
End If

--
John Viescas, author
"Microsoft Office Access 2003 Inside Out" (coming soon)
"Running Microsoft Access 2000"
"SQL Queries for Mere Mortals"
http://www.viescas.com/
(Microsoft Access MVP since 1993)



.
 
Back
Top