Search code examples
comboboxms-access-2013

Turning filled out combo box into a number?


I have 4 combo boxes where you can select an employee. I want to get a value between 0 and 4 to show how many combo boxes have employees in them. I'll be using this number to automatically calculate length of job times. I think I'm all wrong in my approach. I think I need to use str or val.

I'm starting with:

Private Sub ATeamLeaderMon_Change()

If ATeamLeaderMon Is Null Then Me.AMaidMonTotal = Me.AMaidMonTotal + 0
If AMaidMonTotal Is Not Null Then Me.AMaidMonTotal = Me.AMaidMonTotal + 1

End Sub

Solution

  • Try with:

    Me!AMaidMonTotal.Value = Abs(Not IsNull(Me!Combo1.Value)) + Abs(Not IsNull(Me!Combo2.Value)) + Abs(Not IsNull(Me!Combo3.Value)) + Abs(Not IsNull(Me!Combo4.Value))