Combo Box Action

  • Thread starter Thread starter Mike C.
  • Start date Start date
M

Mike C.

Hello.

I have a combo box on a form, cboStates, that contains a
list of States. In addition to the state names, I also
have a name called "Federal". I would like to make it so
that when a user selects Federal, another combo box,
cboAgencies, appears on the form. I usually do this with
a command button witht the event "cboAgencies.visible =
true", but how can I or can this be done when I
select "Federal" from the cboStates combo box?

Any assistance would be appreciated.

Thanks in advance,

m.
 
In the AfterUpdate event of cboStates.

Me.cboAgencies.Visible = Me.cboStates = "Federal"

- Jim
 
Thanks for the reply...

I also accomplished this by using the following:

If StateAffiliation = "Federal" Then
cboAgency.Visible = True
End If

Thanks again.

m.
 
The main functional difference between the two methods is that mine
will make cboAgency visible or NOT visible depending on the results of
the expression. Yours will only set the control to visible. It will
not set it back to not visible when needed - what if the user clicks
"Federal" by mistake? To do that you would need an Else.

Also, my approach is more concise. 1 line vs. 5 lines to accomplish it
with If, Else, End If. ;-)

- Jim
 
Back
Top