Debug gets results, but run causes error 
Author Message
 Debug gets results, but run causes error

When I run my program, I get an error, but when I step
through using debug, everything works fine. Any ideas?

My error is: Row cannot be located for updating. Some
values may have been changed since it was last read.

My code is:
Private Sub CountAndInputListings()
    For i = 1 To intAgent
        For j = 1 To intAgent
            If Agent(i) = Agent(j) Then
                intListings = intListings + 1
            End If
        Next j
        'inputs #of listings into c:\mike\recruits.mdb
database
        Me.adoListings.Refresh
        Me.adoListings.Recordset.MoveFirst
        Do While Not Me.adoListings.Recordset.EOF
            If Me.txtAgent1.Text = Agent(i) Then
                Me.txtListings.Text = intListings
                Me.adoListings.Recordset.Update
'***************ERROR OCCURS ON MOVENEXT LINE
                Me.adoListings.Recordset.MoveNext
            Else
                Me.adoListings.Recordset.MoveNext
            End If
        Loop
        intListings = 0
    Next i
End Sub



Tue, 26 Jul 2005 00:52:01 GMT
 Debug gets results, but run causes error

Hello Mike,

You need to put a line to refresh the Database between the update and the
movenext lines of code :

Example :

      Me.adoListings.Recordset.Update

    Me.adoListings.Refresh

                 Me.adoListings.Recordset.MoveNext

This will solve the problem. ;)

Best Regards,
Robert Mileski


Quote:
> When I run my program, I get an error, but when I step
> through using debug, everything works fine. Any ideas?

> My error is: Row cannot be located for updating. Some
> values may have been changed since it was last read.

> My code is:
> Private Sub CountAndInputListings()
>     For i = 1 To intAgent
>         For j = 1 To intAgent
>             If Agent(i) = Agent(j) Then
>                 intListings = intListings + 1
>             End If
>         Next j
>         'inputs #of listings into c:\mike\recruits.mdb
> database
>         Me.adoListings.Refresh
>         Me.adoListings.Recordset.MoveFirst
>         Do While Not Me.adoListings.Recordset.EOF
>             If Me.txtAgent1.Text = Agent(i) Then
>                 Me.txtListings.Text = intListings
>                 Me.adoListings.Recordset.Update
> '***************ERROR OCCURS ON MOVENEXT LINE
>                 Me.adoListings.Recordset.MoveNext
>             Else
>                 Me.adoListings.Recordset.MoveNext
>             End If
>         Loop
>         intListings = 0
>     Next i
> End Sub



Tue, 26 Jul 2005 01:23:42 GMT
 Debug gets results, but run causes error
That did the trick. Thanks so much. It was my first program, and I'm
happy I could complete it. Thanks again!

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Wed, 27 Jul 2005 03:06:12 GMT
 
 [ 3 post ] 

 Relevant Pages 

1. VFP 7, Error cause a debug window in VFP, how to switch to a seperate window

2. Running a SQL script and getting results ???

3. xp_cmdshell and getting error level results

4. causes error and its not even run, eh?

5. valid errors cause vb to stop running

6. Scripting.Dictionary causes error when running package outside of designer

7. DTS Running DTSRUN Using the NT Scheduler causes Error

8. loading more than 1 crystal report cause a run time error

9. Filter of ADO Recordset causing run-time error 3265

10. Running FixPack caused error

11. ADO causes run-time error

12. Help: Truncate text causes exception in release, but not debug


 
Powered by phpBB® Forum Software