Hi folks!
For some reason this little bit of code works when I step through with the debug toolbar, but not when I just tell it to run. Why is this and how do I make it work as it should do?
In calling sub
If InCboBox(cboDesc, cboDesc.Text) = False Then
cboDesc.Clear
If optFileCode.Value = True Then
LoadFileCodeDescs
Else
LoadPartNoDescs
End If
End If
InCboBox Function (within sep module)
Public Function InCboBox(cboBox As ComboBox, SearchItem As String) As Boolean
'If item is in cboBox then True, else False
InCboBox = False
For i = 0 To (cboBox.ListCount - 1)
If cboBox.List(i) = SearchItem Then
InCboBox = True
Exit For
End If
Next i
End Function
LoadPartNoDescs (LoadFileCodeDescs is similar) Sub LoadPartNoDescs()
'Clear current descriptions
cboDesc.Clear
Dim rs As ADODB.Recordset
Set rs = con.Execute("qryPartNoDescs"
'Load all descriptions to cboDesc
With rs
Do While Not .EOF
cboDesc.AddItem !ProdDesc
.MoveNext
Loop
End With
rs.Close
Set rs = Nothing
End Sub
For some reason this little bit of code works when I step through with the debug toolbar, but not when I just tell it to run. Why is this and how do I make it work as it should do?
In calling sub
If InCboBox(cboDesc, cboDesc.Text) = False Then
cboDesc.Clear
If optFileCode.Value = True Then
LoadFileCodeDescs
Else
LoadPartNoDescs
End If
End If
InCboBox Function (within sep module)
Public Function InCboBox(cboBox As ComboBox, SearchItem As String) As Boolean
'If item is in cboBox then True, else False
InCboBox = False
For i = 0 To (cboBox.ListCount - 1)
If cboBox.List(i) = SearchItem Then
InCboBox = True
Exit For
End If
Next i
End Function
LoadPartNoDescs (LoadFileCodeDescs is similar) Sub LoadPartNoDescs()
'Clear current descriptions
cboDesc.Clear
Dim rs As ADODB.Recordset
Set rs = con.Execute("qryPartNoDescs"
'Load all descriptions to cboDesc
With rs
Do While Not .EOF
cboDesc.AddItem !ProdDesc
.MoveNext
Loop
End With
rs.Close
Set rs = Nothing
End Sub