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
Microsoft Access

Avatar of undefined
Last Comment
donnie91910

8/22/2022 - Mon
tbsgadi

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

Gary
ASKER CERTIFIED SOLUTION
Dale Fye

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
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
donnie91910

ASKER
No error.  It just keeps running in a loop.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
donnie91910

ASKER
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.