Results 1 to 2 of 2
  1. #1
    jaryszek is offline Expert
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2016
    Posts
    568

    Split form and looping within records

    Hi Guys,

    i am looping within split form and changes statuses for each record.

    I am using code:
    Code:
    Private Sub But_export_Click()
    
    
    Dim rsDao As DAO.Recordset
    Dim rsDb As DAO.Database
        
    Set rsDao = Me.RecordsetClone
    Set rsDb = CurrentDb
    
    
    MsgBox rsDao.RecordCount
    
    
    With rsDao
        If Not (rsDao.BOF And rsDao.EOF) Then
            rsDao.MoveFirst
        End If
        Do Until rsDao.EOF
            rsDao.Edit
            Debug.Print rsDao.Fields(10)
            rsDao.Fields(10) = "2017-03-01"
            rsDao.Update
            rsDao.MoveNext
        Loop
        
    End With
    
    
    End Sub
    and problem is within rsDao.edit code, error is occured:



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

    How to update recordset only for filtered values?
    I am using multisearch textboxes with SQL string like below witinh query:
    Code:
    Like "*" & [Formularze]![frmZusFaktur]![Company_name] & "*" Or Is Null Or Like "" & [Formularze]![frmZusFaktur]![Company_name] & ""
    Did you do something similar? Maybe there is different code to use?

    Best Wishes,
    Jacek

  2. #2
    jaryszek is offline Expert
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2016
    Posts
    568
    hmm it is strange:

    i changed my piece of code for:

    Code:
     Do Until rsDao.EOF
           ' rsDao.Fields(12).RecordsetType = 1
            rsDao.Edit
            !Status_name_ID_FK = 3
            rsDao.Update
            rsDao.MoveNext
        Loop
    so now this is working. hmm very strange.

    JAcek

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Help with Looping Records
    By jtm013 in forum Programming
    Replies: 7
    Last Post: 04-30-2015, 01:39 PM
  2. Replies: 1
    Last Post: 07-09-2014, 10:42 AM
  3. do Loops - Not looping thru all records
    By kfschaefer1 in forum Programming
    Replies: 1
    Last Post: 03-27-2014, 11:42 PM
  4. Looping through records in a continous form
    By accessnihon in forum Forms
    Replies: 3
    Last Post: 01-04-2012, 01:04 AM
  5. Looping through Records in SQL
    By make me rain in forum Queries
    Replies: 13
    Last Post: 07-17-2011, 08:58 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums