Results 1 to 2 of 2
  1. #1
    neuk is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    May 2019
    Posts
    36

    Uncheck all records in a field except the one selected

    I'm trying to understand how a piece of code works in a continuous form. The routine clones the form's recordset and moves though each record in the "RiInit" field and deselects all values that are true except the record currently selected. My question is how does it know not to deselect the current record? While this is exactly what I want it to do, I'm just trying to understand the mechanics.



    Code:
    Dim rs As DAO.Recordset
    
    Set rs = Me.RecordsetClone
    
    If rs.RecordCount > 0 Then
        rs.MoveFirst
    End If
    
    While Not rs.EOF
        If rs!RiInit.Value = True Then
            rs.Edit
            rs!RiInit.Value = False
            rs.Update
        End If
        rs.MoveNext
    Wend
    
    Set rs = Nothing

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    run an update query:
    update table set chckbox = false where [id] <> forms!fMyForm!txtID

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

Similar Threads

  1. Replies: 9
    Last Post: 08-07-2017, 12:28 AM
  2. Replies: 3
    Last Post: 10-07-2016, 03:28 AM
  3. Replies: 3
    Last Post: 12-28-2015, 04:11 PM
  4. Replies: 14
    Last Post: 12-06-2012, 11:25 AM
  5. Uncheck Radio Button?
    By taimysho0 in forum Programming
    Replies: 2
    Last Post: 06-29-2012, 03:44 PM

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