Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to make a field visible if other dependent field is completed?

Status
Not open for further replies.

bsarman

Technical User
Feb 10, 2003
73
0
0
US
How to make a field visible if other dependent field is completed?

I have 2 fields in a form:
1) A drop down list to describe call results sales reps make. One of the call results is: Call Again
2) Second field I have is: Call Again Date

I want to make "Call Again Date" field visible only when sales rep selects "Call Again" from the drop down list on field 1.
They select Call Again (field 1).
Call Again Date (field 2) becomes visible. So they can fill out the date a customer wants to be called back.

If sales rep selects any other option from the drop down list on field 1, then I don't want Call Again Date to be visible.

How do I do this?
Thanks.
 
In the AfterUpdate event of the combo you can try something like this :
Me![field 2].Visible = (Me![field 1] = "Call Again")

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Try posting the following code into your form's Code Module:
Code:
[COLOR=green]
' This code assumes that your combo box is named [b]Field1[/b]
' and that the field whose Visible property you wish to
' toggle is named [b]Field2[/b].  Make name changes
' where appropriate.
[/color]
[COLOR=blue]Private Sub[/color] Field1_AfterUpdate()
    Me.Field2.Visible = (Me.Field1 = "Call Again")
[COLOR=blue]End Sub[/color]
 
I tried this as you guys explained:

It's not working and I think I might know why but don't know how to fix it.
Call_Results_ID can't be "Call Again" because this is a drop down list as well and it's a number which is 8.

So I tried;
1- Putting 8 for Call_Results_ID.

Private Sub Call_Results_ID_AfterUpdate()
If Me.Call_Results_ID = "8" Then Me.Call_Again_Date.Visible = True Else Me.Call_Again_Date.Visible = False
End Sub

It didn't work.

2- I tried this:
Private Sub Call_Results_ID_AfterUpdate()
Me.Call_Again_Date.Visible = (Me.Call_Results_ID = "Call Again")
End Sub.

It didn't work either.

What am I doing wrong?


 
Try this code instead:
Code:
[COLOR=blue]Private Sub[/color] Call_Results_ID_AfterUpdate()
    Me.Call_Again_Date.Visible = (Me.Call_Results_ID = 8)
[COLOR=blue]End Sub[/color]
 
To discover how to code the test, just do a Debug.Print Me.Call_Results_ID

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
It's not working and I can't figure out why!?
 
Put a STOP intruction at the beginning of the sub and step by step (F8) look at the variables.

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
How are ya bsarman . . . . .

Try this:
Code:
[blue]Me.Call_Again_Date.Visible = ([purple][b]Val([/b][/purple]Me.Call_Results_ID[purple][b])[/b][/purple] = 8)[/blue]


cal.gif
See Ya! . . . . . .
 
Private Sub Combo8_AfterUpdate()
If Me.Combo8 = "Call Again" Then
Me.callagaindate.Visible = True
Else
Me.callagaindate.Visible = False
End If
End Sub

This worked on a sample table I created. It won't work with the other table since there are more than one rows in that table depending on how many calls were made to that customer on different dates.
So if a sales rep calls a customer on 05/20/04 and the call result for that day might be "Left Message".
And when the sales reps calls the customer again on 05/22/04 and the call result is "Call Again", there'll be 2 result sets with different call result.
So I don't think this would work.

I appreciate everyone's generous support.

Thank you all very much.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top