ANTHONY CHRISTI
asked on
Change a filed from visible to invisible on a form
I am using a continuous form. depending on a field in the same record I need to make the field invisible. All the fields become invisible, not just the one that I selected.
ex: if Field1 = Completed then make Field2, which is STOP to invisible.
ex: if Field1 = Completed then make Field2, which is STOP to invisible.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
In addition to mbizup's comment about locking the field in the Current Event, you could use the GotFocus event of the control to actually shift the focus to another control if [Field1] is completed.
If you use conditional formatting to simply change the foreground and background colors of the control, it can still get the focus, and if it gets the focus, the user can still see the value by highlighting all of the text in the control. If, however, you use the GotFocus event to shift the focus to another control, they will not be able to do this.
If you use conditional formatting to simply change the foreground and background colors of the control, it can still get the focus, and if it gets the focus, the user can still see the value by highlighting all of the text in the control. If, however, you use the GotFocus event to shift the focus to another control, they will not be able to do this.
Private Sub txt_Field2_GotFocus
if [Field1] = "Completed" Then me.txt_Field2.Setfocus
End Sub
<<
it can still get the focus, and if it gets the focus, the user can still see the value by highlighting all of the text in the control
>>
Dale,
I haven't tested this, but I think that locking/disabling the control through the current event would prevent this.
it can still get the focus, and if it gets the focus, the user can still see the value by highlighting all of the text in the control
>>
Dale,
I haven't tested this, but I think that locking/disabling the control through the current event would prevent this.
Miriam,
Disabling (Yes), Locking (No), Changing Fore/Back Colors (No).
Actually, I have used the changing fore/background color technique in the past, because my client did not even want my users to see the "hidden" fields if certain conditions existed. However, when I did this, I encountered the situation that even though the control was not "visible" (same color as the detail background), I could click into it and if I highlighted the text it was readable.
Yes, you could also lock it, but I simply preferred to shift the focus out of that control immediately upon it getting the focus.
Disabling (Yes), Locking (No), Changing Fore/Back Colors (No).
Actually, I have used the changing fore/background color technique in the past, because my client did not even want my users to see the "hidden" fields if certain conditions existed. However, when I did this, I encountered the situation that even though the control was not "visible" (same color as the detail background), I could click into it and if I highlighted the text it was readable.
Yes, you could also lock it, but I simply preferred to shift the focus out of that control immediately upon it getting the focus.
ASKER
Thank you. Worked out perfect.
Open in new window