Results 1 to 6 of 6
  1. #1
    smk081 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Feb 2013
    Posts
    5

    Conditional formatting / Disabled fields not resetting after Creating a New Record

    I have a form that I've programmed some conditional formatting into both in Access and in VBA. What I am experiencing is that everything is working fine, fields that are supposed to be disabled based on the respondents answers are disabling correctly BUT when I create a new record, the fields in this case checkboxes that were grayed out/disabled previously stay that way for the new record. I didn't see a way to do conditional formatting in Access on checkboxes so everything is in VBA.

    To be more particular.

    I have 5 check boxes.

    Option 1
    Option 2


    Option 3
    None
    Unknown

    If ANY Option 1 THROUGH Option 3 is checked, it disables None and Unknown from being selected. Inversely if None is selected - it disables/grays out Unknown and Option 1 THROUGH Option 3. if Unknown is selected - disable/gray out None and Option 1 THROUGH Option 3.

    So this is working just fine but when I click the button to create a new record, and say I had previously checked "None" whcih disabled Option 1 THROUGH Option 3 and Unknown - those fields are disabled on the form for the new record, the checkbox are all unchecked but the fields are disabled.

    I imagine I need to "reset" these fields when the Create New Record is clicked but I'm not sure.

    Any help would be awesome!

    Thanks!

  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,641
    I suspect you need the same code in the current event, which fires when you change records. I'd have a function and call it from multiple places.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    smk081 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Feb 2013
    Posts
    5
    You mean like writing a procedure to run when the Create New Record button is pushed to "reset" the fields?

  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,641
    Well, you haven't shown the code but as I mentioned it probably needs to run in the current event (of the form). That will fire when the user changes records, including a new one.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    smk081 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Feb 2013
    Posts
    5
    Quote Originally Posted by pbaldy View Post
    Well, you haven't shown the code but as I mentioned it probably needs to run in the current event (of the form). That will fire when the user changes records, including a new one.
    I just looked up the event "On Current" which seems to make complete sense. I'm very new to Access and VBA and didn't even realize the Form level Events that you've directed me to. Its extremely helpful.

    My only concern is if someone navigates to a previous record, would it override the input in that record - or would this just have to be something that would be taken into consideration when the procedure in On Current is written? E.g. if I out a procedure in On Current to "refresh" the checkboxes in my original issue, if the user returns to a previous record, the checkboxes that were previously answered, would become reset?

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    Still haven't seen the code, but I expected it would set controls based on others. If something different needs to happen only on a new record, use the current event and test for it:

    If Me.NewRecord Then
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 6
    Last Post: 09-27-2012, 08:27 AM
  2. Replies: 5
    Last Post: 03-14-2012, 08:32 PM
  3. Conditional Formatting
    By Paul H in forum Reports
    Replies: 3
    Last Post: 11-07-2011, 11:59 AM
  4. Resetting Record Source on Form
    By Cheshire101 in forum Programming
    Replies: 5
    Last Post: 05-05-2011, 08:52 AM
  5. Formatting of disabled fields
    By Remster in forum Forms
    Replies: 2
    Last Post: 11-12-2010, 07:03 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