Use F8 to step through your code one line at a timelet me know if i did this right.
I put a break point on line one and and End Sub, used F5 to step through and it errored out right away.
If Not rsSortTemp_In.EOF Then
rsSortTemp_In.MoveFirst
DoCmd.RunSQL "DELETE * FROM tblCID_Out_TEMP;" ' Clear out any old data
strSQL = "[COLOR=red]SELECT * FROM tblCID_Out_TEMP[/COLOR];" ' Open Output recordset
Set rsSortTemp_Out = New ADODB.Recordset
rsSortTemp_Out.Open strSQL, CurrentProject.Connection, adOpenDynamic, adLockOptimistic
End If
"SELECT [COLOR=red]tblCID_Out_TEMp.*[/COLOR] FROM tbl_Out_TEMP;"
That code may look a bit odd but it will work. You only need the longer name if there would be ambiguity with out out it.I think it stops there because you got a empty recordset. In your code:
Code:If Not rsSortTemp_In.EOF Then rsSortTemp_In.MoveFirst DoCmd.RunSQL "DELETE * FROM tblCID_Out_TEMP;" ' Clear out any old data strSQL = "[COLOR=red]SELECT * FROM tblCID_Out_TEMP[/COLOR];" ' Open Output recordset Set rsSortTemp_Out = New ADODB.Recordset rsSortTemp_Out.Open strSQL, CurrentProject.Connection, adOpenDynamic, adLockOptimistic End If
It looks a bit odd don't you think.
Try:
Code:"SELECT [COLOR=red]tblCID_Out_TEMp.*[/COLOR] FROM tbl_Out_TEMP;"
JR![]()
It will work even better with the correct namesWhat do you get if you insert something like
debug.print rsSortTemp!In!Custname , Len(rsSortTemp!In!Custname )
before the error.