I have problem with VBA code select case. Code is linked to combobox(Combo0) and event after update. In combobox there is a list of values: BHP, PPOZ, ISO. When i choose BHP, it should change source object property in subfrom(Child03) to subfrmBHP. Same with PPOZ and ISO. But for some reason, when i choose BHP it shows table from PPOZ, when i choose PPOZ it shows BHP and when i choose ISO it shows BHP. Code looks like this:
Private Sub Combo0_AfterUpdate()
Select Case ChangeCombo
Case Combo0 = "BHP"
Forms("frmInstrukcje").Form.Child3.SourceObject = "subfrmBHP"
Case Combo0 = "PPOŻ"
Forms("frmInstrukcje").Form.Child3.SourceObject = "subfrmPPOZ"
Case Combo0 = "ISO"
Forms("frmInstrukcje").Form.Child3.SourceObject = "subfrmISO"
End Select
End Sub
I aleredy recreated tables, form, sub form. Someone suggested me it could be data binding in subform, but there is nothing written there.
Your method references two controls, ChangeCombo
and Combo0
. Not sure if it's a typo or you have something else in mind.
Anyway, Case Combo0 = "BHP"
is incorrect, so assuming Combo0
is the correct control, try the below.
Private Sub Combo0_AfterUpdate()
With Forms("frmInstrukcje").Form.Child3
Select Case Me.Combo0.Value
Case "BHP":
.SourceObject = "subfrmBHP"
Case "PPOŻ":
.SourceObject = "subfrmPPOZ"
Case "ISO":
.SourceObject = "subfrmISO"
End Select
End With
End Sub