Hello, I have a question about how to automatically change other field's properties when a filed changes without clicking.
on the form, I have a field called "DIADL". it is a sum of D1 to D7.
If the sum of D1 to D7 equals to 24, then fields D9 to D15's won't be seen (acPropertyVisible = 0) otherwise, they should be seen and be entered values.
My code is here:
If DIADL = 24 Then
Dim i As Integer
For i = 9 To 15
DoCmd.SetProperty "D" & i, acPropertyValue, 3
DoCmd.SetProperty "D" & i, acPropertyVisible, 0
Next
Else
Dim j As Integer
For j = 9 To 15
DoCmd.SetProperty "D" & j, acPropertyVisible, -1
Next
End If
The code works when I use DIADL onclick event. However, I don't want users to click this filed. The field would be invisible at the final form and whenver the user change any values of D1 to D7, D9 to D15's visible property should be automatically changed accordingly. I wonder which event I should use? I have tried afterupdate event and change event, none of them work.
Many thanks!
on the form, I have a field called "DIADL". it is a sum of D1 to D7.
If the sum of D1 to D7 equals to 24, then fields D9 to D15's won't be seen (acPropertyVisible = 0) otherwise, they should be seen and be entered values.
My code is here:
If DIADL = 24 Then
Dim i As Integer
For i = 9 To 15
DoCmd.SetProperty "D" & i, acPropertyValue, 3
DoCmd.SetProperty "D" & i, acPropertyVisible, 0
Next
Else
Dim j As Integer
For j = 9 To 15
DoCmd.SetProperty "D" & j, acPropertyVisible, -1
Next
End If
The code works when I use DIADL onclick event. However, I don't want users to click this filed. The field would be invisible at the final form and whenver the user change any values of D1 to D7, D9 to D15's visible property should be automatically changed accordingly. I wonder which event I should use? I have tried afterupdate event and change event, none of them work.
Many thanks!