OK, OK, so this might be a little complicated. I'm using VB6 and SQLServer2000. I'm looking for a way to trap an error I am receiving on the line:

adoCityStateID.Refresh

I receive error #3704 - Operation is not allowed when object is closed. The funny thing is this operation works great and it's fast as lightning! If I remove the line, the update does not work. Even with error trapping, I can't seem to remove the error so the operator doesn't know it happens.

Any Ideas?


SQL = "UPDATE TCityStateID" _
& " SET TCityStateID.SalesRepID = '" & dbcSalesRep.BoundText & "'" _
& " FROM TCityStateID"

If dbcStateName <> "<select>" Then
SQL = SQL & " WHERE StateName= '" & dbcStateName & "'"
End If
If dbcCountyName <> "<all>" Then
SQL = SQL & " WHERE CountyName + ', ' + StateName= '" & dbcCountyName & "'"
End If
If dbcCityName <> "<all>" Then
SQL = SQL & " WHERE CityName + ', ' + StateName = '" & dbcCityName & "'"
End If


adoCityStateID.RecordSource = SQL
On Error Resume Next
adoCityStateID.Refresh

MsgBox "Update Completed! Just igone that error.", vbOKOnly, "Update Confirmation"