Hi all

Trying to fix a crazy problem.
My program is alright on debug,but the compiled version always crashes.

The function:

Public Function combo_list(cur_cb As ListBox, count As Integer, Optional text_str) As Integer
On Error GoTo erhand

Dim i As Integer

Dim found As Integer

i = 1
If IsMissing(text_str) Then
i = 2
check_test = cur_cb.Text
Else
i = 3
check_test = text_str
End If
i = 4
i = 5

For i = 0 To count
If check_test = cur_cb.List(i) Then
found = 1
Exit For
End If
Next

If found = 1 Then
combo_list = i + 1
Else
combo_list = -1
End If

Exit Function
erhand:
MsgBox "combolist : " & Chr(13) & Err.Description & Chr(13) & "number: " & Err.Number & Chr(13) & "number of items: " & " number in loop: " & i & Chr(13) & "list box is: ", 64

End Function

the i variable indecates where the function crashes in the error message.
it always happens when I call a method of cur_cb
(cur_cb.List(i) or cur_cb.Text)

Is there any logical explantion ???

Thanks.
Dan.