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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Visible Problem

Status
Not open for further replies.

marie515

Technical User
Feb 27, 2004
71
US
Hi everyone,

I have a drop down field in which a user can select one of many items. In that drop down, there are 2 items that when they are selected, three other fields become "visible" and the user would fill in these other 3 fields, otherwise they would remain invisible. Here is my code on the main drop down:

Private Sub cboTypeOfIssue_BeforeUpdate(Cancel As Integer)
' This will set the ATC sub category to be visible if Access To Care is selected
If cboTypeOfIssue = "Access To Care - ATC/QOC/QOS/COC/TOC" Or cboTypeOfIssue = "Grievance" Then
cboATCReason.Visible = True
cboATCspecialist.Visible = True
cboATCcounty.Visible = True
ElseIf cboTypeOfIssue <> "Access To Care - ATC/QOC/QOS/COC/TOC" Or cboTypeOfIssue <> "Grievance" Then
cboATCReason.Visible = False
cboATCspecialist.Visible = False
cboATCcounty.Visible = False
End If

End Sub

PROBLEM: The fields that should be invisible (all of the time unless the result is a "true" as defined above) is not the case. The fields are invisible when you first select a type of issue that is not related to the true statements above, but if you go out of the case and go back in, the fields are now visible?

Any ideas? Let me know if this is unclear...Thanks!
 
what value would the comobobox have when you first went through the statement, and then what value would it have when you went through again and the fields became visible? the same?
 
Hi JimbOne.

I'm not sure what you mean by "value"? Can you clarify?
 
First of all, this
[blue][tt]
ElseIf cboTypeOfIssue <> "Access To Care - ATC/QOC/QOS/COC/TOC" Or
cboTypeOfIssue <> "Grievance" Then
[/tt][/blue]
will always be TRUE because cboTypeOfIssue will always be "not equal" to one value or the other. You probably need [COLOR=red yellow]AND[/color] rather than [COLOR=red yellow]OR[/color].

Second ... place a Debug.Print before the IF and track what values cboTypeOfIssue has on the second pass through the Sub.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top