0
votes

I need to show denominations based on selection in combo box in my access form.

The tricky thing here is that I need to show immediately after selecting in the combo box (without saving it). This one is working just after I save my selection.

If cmb_Main_Impact.Value = "Productivity" Then
Me.txt_Units = "minutes"
End If

If cmb_Main_Impact = "Quality" Then
Me.txt_Units = "number of errors"
End If
1
Where did you place that code? Is your ComboBox in a UserForm?R3uK
That code should run in the AfterUpdate event of the combobox. A combobox doesn't have a save event.Gustav

1 Answers

0
votes

That code should work fine. You want to put it in the combobox on change event.

Also added an elseif so there isnt multiple if and end ifs. Put that code in in the userform that has the combo box.

So your code will look like.

Private Sub cmb_Main_Impact_Change()

    If cmb_Main_Impact.Value = "Productivity" Then
        Me.txt_Units = "minutes"

    elseIf cmb_Main_Impact = "Quality" Then
        Me.txt_Units = "number of errors"
    End If

End Sub