Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MoveLast doesn't appear to be working... 1

Status
Not open for further replies.

irethedo

Technical User
Feb 8, 2005
429
0
0
US
I have the following code and I am stepping through it and monitoring a watch variable for rsx.EOF
but immediately after it executes the rsx.MoveLast line in the code, the watch variable stays at
rsx.EOF False

I would expect it to be True after executing this. Any suggestions why it isn't?

Thanks

Code:
  strSql = "Select * from SameOrd_tbl order by License_PartNO"
   Set rs = CurrentDb.OpenRecordset(strSql, dbOpenDynaset)
   strSql = "Select * from PC_Lic_Line_tbl order by License"
   Set rsx = CurrentDb.OpenRecordset(strSql, dbOpenDynaset)
   
   If rs.RecordCount > 0 Then      ' if this is an empty table then don't bother...
      rs.MoveFirst                    ' Get first rsx record
      If rsx.RecordCount > 0 Then      ' if this is an empty table then don't bother...
         Do While Not rs.EOF
            rsx.MoveFirst                     ' Get first rs record
            Do While Not rsx.EOF
               If rs!License_PartNO = rsx!License Then
                  rs.Edit
                     rs!SystemType = rsx!SysType
                  rs.Update
                 [highlight #FCE94F] rsx.MoveLast[/highlight]
               Else
                  rsx.MoveNext
               End If
            Loop
            rs.MoveNext
         Loop
      End If
   End If
   rs.Close
   rsx.Close

This code was working fine for some time and all of a sudden it started to get hung up
because the Movelast stopped setting the table to EOF.

I closed the database for a few minutes and then no problems it worked fine but
after half a dozen times with no reoccurring incidents it reared its ugly head again.

any ideas how to trouble shoot this problem?

Thanks
 
rsx.MoveLast points to the last record in your rsx and that's why rsx.EOF False.

If you would do:[tt]
rsx.MoveLast
rsx.MoveNext [/tt]-> that would point you to EOF (rsx.EOF = True)


Have fun.

---- Andy

There is a great need for a sarcasm font.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top