I'm using MS Access VBA to import from an iSeries table. Sometimes the IBM table can be empty, which is ok. However, when this occurs I receive VBA error 3021 - do I need to change my code or can I just suppress the error message. Here is my code:
Set rs = New ADODB.Recordset
rs.Open sSQL, cn, adOpenDynamic, adLockOptimistic
'Open recordset to local table
Set rsL = New ADODB.Recordset
rsL.Open sTBL, CurrentProject.Connection, adOpenDynamic, adLockOptimistic
rs.MoveFirst
Debug.Print "AS400"
Do Until rs.EOF
Debug.Print rs.Fields("DROP"), rs.Fields("STDATE"), rs.Fields("ENDATE")
rsL.AddNew
rsL.Fields("DROP") = rs.Fields("DROP")
rsL.Fields("STDATE") = rs.Fields("STDATE")
rsL.Fields("ENDATE") = rs.Fields("ENDATE")
rsL.Update
rs.MoveNext
Loop
'Test to check if above code actually worked
rsL.MoveFirst
Debug.Print "Local"
Do Until rsL.EOF
Debug.Print rsL.Fields("DROP"), rsL.Fields("STDATE"), rsL.Fields("ENDATE")
rsL.MoveNext
Loop
'Clear memory
Set rs = Nothing
Set rsL = Nothing
Set cn = Nothing