Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2011
    Posts
    28

    Unanswered: Move Next CheckBox Form Coding problem

    Code:
    Dim rst As DAO.Recordset
        
        If Me.Check_Selected = True Then
            Set rst = Me.RecordsetClone
            rst.Bookmark = Me.Bookmark
            Do
                rst.MoveNext
                If rst.EOF Then MsgBox "No more records available!": Exit Do
            Loop Until rst!Selected = False
            If rst.EOF = False Then Me.Bookmark = rst.Bookmark
        Else
          MsgBox "Current Record Needs to be Completed!"
          Exit Sub
        End If
        rst.Close
        Set rst = Nothing
    I've been given this code to use which works a treat for what I initially asked for.

    However say their are 10 records and 3ppl working each record. They all end up starting at the same record, and then each of them being taken to the same next record, as they dont click the checkbox until they've completed the work.

    To avoid this would I need to add another field to represent that the record in the form is "Active" to exclude it from the MoveNext step.... or is there a way to code this in? Ideally I need 5-10 users in the database at the same time.

    Many Thanks!!!
    Last edited by Range; 06-09-11 at 04:32.

  2. #2
    Join Date
    Oct 2003
    Location
    London
    Posts
    341
    You could actually get around this by allowing the check box to have a trible state.

    Go into the form design, select the check box, look at it's data settings and turn triple state to Yes.

    You then have 3 outputs for the check box

    -1 = Checked
    0 = Not Checked
    Null = the third state

    You would need also something which turned the active record into the 3rd state ( Me.Check_Selected = Null ). I'd suggest that you put some code in so that as soon as someone starts editing the record it turns it to the Null State and then turns it back to the Checked/Not Checked upon leaving that record.


    I imagine that your code would therefore look something like;

    Code:
    Dim rst As DAO.Recordset
    
    If isnull (Me.Check_Selected) Then
    
          MsgBox "This Record is currently being modified!"
    
    Else
    
        If Me.Check_Selected = -1 Then
            Set rst = Me.RecordsetClone
            rst.Bookmark = Me.Bookmark
            Do
                rst.MoveNext
                If rst.EOF Then MsgBox "No more records available!": Exit Do
            Loop Until rst!Selected = False
            If rst.EOF = False Then Me.Bookmark = rst.Bookmark
        Else
          MsgBox "Current Record Needs to be Completed!"
          Exit Sub
        End If
    End If
    
        rst.Close
        Set rst = Nothing
    Last edited by christyxo; 06-09-11 at 13:01.

  3. #3
    Join Date
    Mar 2011
    Posts
    28
    Is there no way that Access can automatically tell that someone is in a record?
    Access 2003 User.
    Limited experience with Access.
    Poor Coder.... pls be paitient with me!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •