Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6771631
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:27:18+00:00 2026-05-26T15:27:18+00:00

I am trying to run the following code to loop around a recordset and

  • 0

I am trying to run the following code to loop around a recordset and do updates where neccessary.

I have a Microsoft Access database connected to a MySql backend. Whenever I run this code I get the following error:

3197 error: The Microsoft Office Access database engine stopped the process because you and another user are attempting to change the same data at the same time.

The code is below:

Private Sub test()
    Dim rs As DAO.Recordset, rsCnt As Long, i As Long

    Set rs = CurrentDb.OpenRecordset("qryMyQuery", DB_OPEN_DYNASET)
    rs.MoveLast
    rsCnt = rs.RecordCount
    rs.MoveFirst
    For i = 1 To rsCnt
        rs.Edit
        rs!MyFieldInTable = "test"
        rs.Update
    Next i
End Sub

I thought the Access database might be corrupt so I pulled an earlier backup but it’s doing the same thing which makes me think it’s a MySql issue.

We use an identical piece of code on another version of this database linked to a different MySql table and it works fine.

Also, when I open the query the record-set is based on I can edit the data in the query without any issues.

Just to add, on the first loop, rs!MyFieldInTable is updated, then I get the error.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T15:27:18+00:00Added an answer on May 26, 2026 at 3:27 pm

    It does not appear that you are moving to another record in the recordset. Simply incrementing i doesn’t move to the next record. A more traditional approach would be to iterate over the recordset without the need for your other variables (i and rsCnt).

    Dim rs as DAO.Recordset
    Set rs = CurrentDb.OpenRecordset("qryMyQuery", DB_OPEN_DYNASET)
    rs.moveFirst
    Do Until rs.EOF
        rs.Edit
        rs!FieldNameHere = "test"
        rs.Update
        rs.MoveNext
    Loop
    

    EDIT
    After a bit of searching I came across this thread which seems to be similar to your issue. At the bottom of the thread a suggestion is made to modify the ODBC settings for your MySQL DSN by selecting the “Advanced” tab and selecting the option to “Return Matching Rows”. The post also says to drop the linked table and then re-link it to your Access database.
    I haven’t used Access with MySQL in the past, so I have no idea whether this will work or not, so proceed with caution!

    You may also try changing your recordset to use the dbOptimistic flag for the recordset locking option to see if that helps at all:

    set rs = CurrentDB.OpenRecordSet("qryMyQuery", DB_OPEN_DYNASET, dbOptimistic)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code, does this run an endless loop? I am trying
I am trying to run the following code from within Eclipse: Process process =
I am trying to run the following code (which I got from here ).
I am trying to run the following ruby code from IRB but am unable
I'm trying to run this jQuery selector: $(#label option[value=\newLabel\]) On the following code: <select
I am trying to run the following code within SQLPlus: exec lbacsys.sa_sysdba.create_policy(policy_name => 'ACCESS_LOCATIONS',
When trying to run the following program code, this error occurred; Input string was
I'm trying to run the following code, but I'm getting a Type mismatch compile
Why does the following code compile and run. I have created an integer array
I'm trying to understand compile versus run-time computation in java. I have the following

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.