I am matching 2 combo box indexes
Some of my users are getting a Invalid property value in this procedure, Why?
Code:If frmMain.cboPitch.ListIndex <> -1 Or frmMain.cboPitch.Text <> "" Then
Me.cboPitch.ListIndex = frmMain.cboPitch.ListIndex
End If
Printable View
I am matching 2 combo box indexes
Some of my users are getting a Invalid property value in this procedure, Why?
Code:If frmMain.cboPitch.ListIndex <> -1 Or frmMain.cboPitch.Text <> "" Then
Me.cboPitch.ListIndex = frmMain.cboPitch.ListIndex
End If
If frmMain.cboPitch has more entries than Me.cboPitch, that error is very possible.
You may want to double check the ListCounts of both of those comboboxes. Otherwise, I don't think we have all the details, like where do the combo box entries come from, for both of the combo boxes.
Thanks
You are right, the list counts are different. I had entered a routine a couple yrs ago for this:
Must have the problem routine later, without noticingCode:Public Sub MatchCboIndexes()
10 On Error GoTo e
20 Select Case Me.cboPitch.ListIndex
Case 0
30 frmNewPricePerSq.cboPitch.ListIndex = Me.cboPitch.ListIndex
40 Case 1 To 8
50 frmNewPricePerSq.cboPitch.ListIndex = Me.cboPitch.ListIndex + 2 'gPitchIndex + 2
60 Case 9
70 frmNewPricePerSq.cboPitch.ListIndex = Me.cboPitch.ListIndex + 3 'gPitchIndex + 3
80 Case Is > 9
90 frmNewPricePerSq.cboPitch.ListIndex = 13
100 End Select
110
120 Exit Sub