Repost: Display 1 of 2 subforms based on combo box value

J

Johnjmn

I phrase this wrong in the original post

I have a form (Customers) which has 2 subforms (Support and Product) one
over the other. I am hoping to use a combo box (or any other tool) to have
only 1 subforms displayed depending on the value of the combo box. I am open
to any suggestions to accomplish this task.
TIA
 
O

Ofer

On the after update event of the combo, write the code
If Me.MyComboName = Value then
me.SuForm1.visible = True
me.SuForm2.visible = False
Else
me.SuForm1.visible = False
me.SuForm2.visible = True
End If
 
K

KARL DEWEY

Your choices seem to be product or service.

Why not include both in the same table and flag a text field as "P" or "S"
then you could use a command button to change criteria of a query. The
different criteria would pull the records for the one you want.
 
J

Johnjmn

In attempting the formula below, I get error on MyCombo56
Is the value need to be entered, if so what is the value.

Private Sub Combo56_AfterUpdate()
If Me.MyCombo56 = Value Then
Me.Support.Visible = True
Me.Product.Visible = False
Else
Me.Support.Visible = False
Me.Product.Visible = True
End If

End Sub
 
D

Douglas J Steele

I believe Ofer used Value as a placeholder. Presumably you know what the
value will be: replace the word Value in the code with that value. (Remember
to put it in quotes if it's a text value)
 
O

Ofer

Also remove the My Before the name of the field, And as Doug mantioned, if
the combo field is string type the use that
If Me.Combo56 = "Value" Then

Private Sub Combo56_AfterUpdate()
If Me.Combo56 = Value Then
Me.Support.Visible = True
Me.Product.Visible = False
Else
Me.Support.Visible = False
Me.Product.Visible = True
End If

End Sub
 
Top