Results 1 to 11 of 11
  1. #1
    BRASILO is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Aug 2017
    Posts
    77

    CHECK BOX Enables record per selection in continus form???

    Hello,

    I need help with the following:



    I have a continuous form that has a check box and 5 fields in a continuous form. I'm attempting to get this check box to only enable the record for edit as you check the check box next to the record line. However, when you check or uncheck the box all the records open for edit, to include the ones whos check box was not checked. Please help.

    The following code is what I have:

    Code:
            With Me.Recordset
            Do While Not .EOF
                If Me.cmBOX = 0 Then
                Field1.Enabled = False
                Field2.Enabled = False
                Else
                Field1.Enabled = True
                Field2.Enabled = True
                End If
            Loop
        End With

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Code like that won't work on a continuous form. Look at Conditional Formatting on the ribbon.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    BRASILO is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Aug 2017
    Posts
    77
    Quote Originally Posted by pbaldy View Post
    Code like that won't work on a continuous form. Look at Conditional Formatting on the ribbon.
    I see I ended up trying this instead. However, all my other records update as well. I'm trying to only update the records that I select.

    Code:
    Dim db As DAO.Database
    Dim rs As DAO.Recordset
    If cmBOX= True Then
    Set db = CurrentDb()
    Set rs = db.OpenRecordset("QRY_DataTBL", dbOpenDynaset)
    rs.FindFirst "ID = '" & Me.ID & "'"
    rs.Edit
    rs!conCOMMENTS = Me.conCOMMENTS
    rs!IScomments = Me.IScomments
    rs.Update
    End If
    Me.Requery
    rs.Close
    Set rs = Nothing
    Set db = Nothing

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    That looks like a completely different issue. That looks like it would update a single record. From the sound of it, I'd use an update query like on your other thread. I hope you're not in a multi-user environment, as using a checkbox in the data to select records could be problematic.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    BRASILO is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Aug 2017
    Posts
    77
    Quote Originally Posted by pbaldy View Post
    That looks like a completely different issue. That looks like it would update a single record. From the sound of it, I'd use an update query like on your other thread. I hope you're not in a multi-user environment, as using a checkbox in the data to select records could be problematic.
    I'm hoping to do both in one. When the check box is selected, the other records can't be edited only the checked one will allowed to be edited and posted to the tbl. However, i'm not getting anywhere....

  6. #6
    BRASILO is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Aug 2017
    Posts
    77
    Quote Originally Posted by pbaldy View Post
    That looks like a completely different issue. That looks like it would update a single record. From the sound of it, I'd use an update query like on your other thread. I hope you're not in a multi-user environment, as using a checkbox in the data to select records could be problematic.
    I think I'm close, on my QRY, I have the a Where statement that equals yes. So only that checked one should go through. However, if I type info in the other fields that are not being "grayed out" They update as well.....

  7. #7
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Well, they're different. Your first post would allow the user to edit. Your second is actually doing the editing. If you want to edit multiple records with that text, use an update query like the other thread but with a criteria on the Yes/No field.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  8. #8
    BRASILO is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Aug 2017
    Posts
    77
    Quote Originally Posted by pbaldy View Post
    Well, they're different. Your first post would allow the user to edit. Your second is actually doing the editing. If you want to edit multiple records with that text, use an update query like the other thread but with a criteria on the Yes/No field.
    Any suggestions as to how I can restrict the fields unless selected?

  9. #9
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Along the lines of

    strSQL= "UPDATE TableName SET conCOMMENTS= '" & Me.conCOMMENTS & "' WHERE YesNoField = True"
    CurrentDb.Execute strSQL
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  10. #10
    Micron is offline Very Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    You can decipher which record a user selects on in a continuous form even if all controls are disabled, as long as there's a way to select or navigate to a record. That might only be the default record navigation on the left side of the form, or keyboard input. The form Current event can get the value of any field, which you can then use as criteria in an Update query. No check boxes or buttons are needed, although I suppose you'd need an input form to permit the user to edit only the fields you allow.

    Alternatively, set the control(s) to be enabled but locked. Then they can be clicked on but not edited, thus you can know which control and what value it contains. I suppose there are many other ways to arrive at the desired result as well. Again, some type of edit form would be required.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  11. #11
    BRASILO is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Aug 2017
    Posts
    77
    Quote Originally Posted by Micron View Post
    You can decipher which record a user selects on in a continuous form even if all controls are disabled, as long as there's a way to select or navigate to a record. That might only be the default record navigation on the left side of the form, or keyboard input. The form Current event can get the value of any field, which you can then use as criteria in an Update query. No check boxes or buttons are needed, although I suppose you'd need an input form to permit the user to edit only the fields you allow.

    Alternatively, set the control(s) to be enabled but locked. Then they can be clicked on but not edited, thus you can know which control and what value it contains. I suppose there are many other ways to arrive at the desired result as well. Again, some type of edit form would be required.
    Thank you for the detailed help. I ended creating a second form that populates with the selection. from testing it seemed like the better way to get it done.

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

Similar Threads

  1. Replies: 2
    Last Post: 05-29-2014, 09:58 PM
  2. Replies: 6
    Last Post: 11-30-2013, 06:23 AM
  3. Replies: 7
    Last Post: 01-17-2013, 07:20 PM
  4. Replies: 3
    Last Post: 10-20-2012, 09:18 AM
  5. Replies: 3
    Last Post: 06-08-2009, 08:20 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