Manipulate multiple fields visibility

  • Thread starter Thread starter Scott Sabo
  • Start date Start date
S

Scott Sabo

Hello-

I have a sub form "sfrmAccuracy", where I have several fields. I have
a combo box called cboAccType which has a value list containing
"Credits/Returns;User Forms" as the 2 selectable values. If the user
selects "Credit/Returns" I want to hide the next field "cboFormType"
and if the user selects "User Forms" I want to hide a different field
called AccInvoice. I have read on how to hide one field based on a
value, but I want to know how to code the AfterUpdate on cboAccType to
hide field "A" if selection "1" is made or hide field "B" if selection
"2" is made. I could not figure out the code to manipulate more than
one field in the AfterUpdate event.

Please help.....

Scott Sabo
 
It would go something like this in the AfterUpdate of the
cboAccType control
If me.cboAccType = "Credit/Returns" Then
me.AccInvoice.Visible = true
me.cboFormType.Visible = False
Else
If me.cboAccType = "User Forms" Then
me.cboFormType.Visible = true
me.AccInvoice.Visible = False
End If
End If

Good Luck

Jim
 
Try something along the lines of

if cboAccType.ListIndex = 0 then
cboFormType.visible = False
accInvoice.visible = True
else
cboFormType.Visible = True
accInvoice.Visible = False
end if

Hope That Helps
Gerald Stanley MCSD
 
This approach worked when I plugged the code into my sub form.
Unfortunately, once I added the subform to my main form, the field for
AccInvoice does not show up in any records. The subform is set up as a
continuous form. Is this part of my problem?

Scott
 
If cboAccType is an unbound control on your subForm, then
you will have problems. Unbound controls do not really
work at all well on continuous forms.

Gerald Stanley MCSD
 
I think you have to use the subform's Current event as well (that is,
put the code Gerald provided in a separate routine you call from both
the -what is it?- control_Click and Form_Current events. It may look
weird, because indeed the whole column of fields swaps in an out of
view. Something we all get used to.
 
Back
Top