Open the main form in design view and find the On Current event of the form.
Double-click the On Current event to display:
On Current: [Event Procedure]
Then click the [...] to the right of this property to display the module
window for your form.
Your code window should display:
Private Sub Form_Current()
End Sub
Add this line:
Private Sub Form_Current()
DisableSome
End Sub
Then add this code below the End Sub
Sub DisableSome()
'change the control names to match yours
If Me.txtSpecialy = "AA" Then
Me.sfrmName.Form!txtCost.Enabled = False
Else
Me.sfrmName.Form!txtCost.Enabled = True
End If
End Sub
Then add code to the After Update event to the control txtSpecialty
Private Sub txtSpecialty_AfterUpdate()
DisableSome
End Sub
This should disable the txtCost control on your subform when txtSpecialty on
your main form has the value "AA".
--
Duane Hookom
Microsoft Access MVP
vassilis said:
hello Duane thanks for your replay but can u be more specific pls because i
have no
idea about coding ....i have a form(B) with a field "cost" , this form is a
subform in another form (A) with a field "speciality" (for
example)....everytime where "speciality" take a pecific value "AA" the "cost"
field to get disabled...
thanks
:
You can create a function or sub in your form's module like:
Sub DisableSome()
If Me.chkSomeField = False Then
Me.txtDateField.Enabled = False
Else
Me.txtDateField.Enabled = True
End If
End Sub
You could then call this sub from the On Current event of the form and the
After Update event of chkSomeField.
--
Duane Hookom
Microsoft Access MVP
:
hello...
i was trying to find a way , some fields in a form get appeard disabled (you
can nt import value) if, for example another column had a specific value .
is that possible? thanks