Link to home
Start Free TrialLog in
Avatar of donnie91910
donnie91910

asked on

MoveNext not working, VBA code.

I just converted an Access 97 database to Access 2003, for some reason when I get to the line:
If (rsSource("Tree_Num") <> rsUpdate("Tree_Num")) Then    
      rsUpdate.MoveNext

rsupdate.MoveNext works fine, but when it gets to the line:
Else
              rsUpdate.MoveNext
              rsSource.MoveNext

the rsSource.MoveNext does not work.

Any help is greatly appreciated.


Code.txt
Avatar of tbsgadi
tbsgadi
Flag of Israel image

Have you used Dim .... as DAO. ....?

Gary
ASKER CERTIFIED SOLUTION
Avatar of Dale Fye
Dale Fye
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of donnie91910
donnie91910

ASKER

It skips over the command and does not do anything.
When it gets to the command:
Else
              rsUpdate.MoveNext
              rsSource.MoveNext
It skips over the rsSource.MoveNext command.
End If
             If rsUpdate.EOF Then
                rsUpdate.MoveFirst  'This is the line that it skips over, it does not go to the next rsUpdate record.
It looks like it cannot find the rsUpdate.EOF in order for the rsSource.MoveNext to happen.

thanks.


Basically what it does is it checks to see if :
It will move through the code:
If (rsSource("Tree_Num") <> rsUpdate("Tree_Num")) Then    
      rsUpdate.MoveNext
So it moves through
No error.  It just keeps running in a loop.
Added a line of code:
End If
             If rsUpdate.EOF Then
                rsSource.MoveNext   'Added line to increment through rsSource records.
                rsUpdate.MoveFirst  


This was good to have to check for EOF.
debug.print rsSource.absoluteposition, rsSource.eof
thanks.