Show/Hide a field based on another field (1 Viewer)

Jvr_gdl

New member
Local time
Today, 11:19
Joined
Mar 13, 2012
Messages
2
Hello,

I'm working in a Form and I'd like to show The "Spouse" Field only if the "Single" answer is YES otherwise Spouse Field must remain hidden.

Single: YES/NO
Spouse: Type name of spouse

Hope you access gurus can help me with this, thanks in advanced.

Regards
 

Jvr_gdl

New member
Local time
Today, 11:19
Joined
Mar 13, 2012
Messages
2
Thanks Paul I found the fix in another Post.

Using the following code at the "On Current" Form and at the "After Update" Field I was able to hide it.

If [Single] = "Yes" Then
Spouse.Visible = True
Else
Spouse.Visible = False
End If

This site is really helpful, I'm glad I found it.
Greetings since Mx
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 11:19
Joined
Aug 30, 2003
Messages
36,129
Happy to help (though your code seems reversed).
 

fibayne

Registered User.
Local time
Today, 20:19
Joined
Feb 6, 2005
Messages
236
Hi
Apologies for posting on an older thread..
I am using this code to (not very successfully) show/hide fields. By selecting a value in a combo box cboAcctID fields txtAcctDR and txtAcctCR are updated with a value, or not depending on the whether there is a value to update with.
If after the update there is now a value in txtAcctDR, cboPayer should not be visible and if there is a value in txtAcctCR, cboPayee should not be visible.
It isn't working in all scenarios and I cant see why, does the code look like it should work ?

Private Sub Form_Current()
If [txtAcctDR] > 0 Then
cboPayer.Visible = False
[txtAcctDR].Visible = True
Else
cboPayer.Visible = True
[txtAcctDR].Visible = False
End If
If [txtAcctCR] > 0 Then
cboPayee.Visible = False
[txtAcctCR].Visible = True
Else
cboPayee.Visible = True
[txtAcctCR].Visible = False

End If

End Sub

thanks for any help
Fi
 

Mihail

Registered User.
Local time
Today, 21:19
Joined
Jan 22, 2011
Messages
2,373
This code is equivalent with yours
Private Sub Form_Current()

txtAcctDR.Visible = (txtAcctDR >0)
cboPayer.Visible = Not txtAcctDR.Visible

txtAcctCR.Visible = (txtAcctCR >0)
cboPayee.Visible = Not txtAcctCR.Visible

End Sub

It isn't working in all scenarios...
Be more specific: In what scenarios don't work ?
 

Users who are viewing this thread

Top Bottom