Can anyone tell me why i am getting error object invalid or no longer set.here is the code what i have written.any help would
be greately appreciated.
Private Sub FillVendorList()
Dim rs As New ADODB.Recordset, sqlQuery As String, i As Integer
sqlQuery = "Select Suppliers.sup_id,Suppliers.Sup_name from Suppliers order by Suppliers.sup_name"
' Set rs = New ADODB.Recordset
Set rs = New ADODB.Recordset
' rs.Open sqlQuery, con, adOpenDynamic, adLockOptimistic
rs.Open sqlQuery, con, adOpenDynamic, adLockOptimistic
If Not (rs.EOF And rs.BOF) Then
rs.MoveFirst
Do Until rs.EOF
Combo2.List(i) = rs!sup_name & ""
Combo2.ItemData(i) = rs!sup_id
i = i + 1
rs.MoveNext
Loop
End If
Combo2.Text = "sugvendor"
Combo2.ListIndex = -1
rs.Close
Set rs = Nothing
End Sub