Page 1 of 2 12 LastLast
Results 1 to 15 of 19
  1. #1
    jdashm is offline Advanced Beginner
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2016
    Posts
    58

    Conditional Formatting in a Continuous Form in Access 2007

    I have a continuous form in which I need 3 fields to be disabled based on a user clicking in a checkbox (marking it to True).


    I have created some VBA to deal with that but it seems to disable those fields in all the records instead of just the current one.
    I have also tried some Conditional Formatting to disable these fields but it does not seem to work. Is this a condition of continuous forms?
    Here is the vba that I have currently have...
    ==================================================
    Private Sub ysnShipReady_AfterUpdate()
    ' Enables or Disables Drivers Name, No. of Pkgs, Pickup Time fields if chkShipReady checkbox is on/off



    If Me.ysnShipReady = True Then


    Me.strDriverName.Enabled = False
    Me.bytNoPkgs.Enabled = False
    Me.dtmPickUpTime.Enabled = False



    Else
    Me.strDriverName.Enabled = True
    Me.bytNoPkgs.Enabled = True
    Me.dtmPickUpTime.Enabled = True


    End If


    End Sub
    =========================================
    Thanks in advance for the help.

  2. #2
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,803
    Access does not distinguish between a control on one record versus another when it comes to continuous forms, and this includes conditional formatting.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    I'm going to disagree. Conditional Formatting will format controls in different records differently based on the condition. That's its purpose in life. As long as your controls are textboxes, you should be able to disable them conditionally. You'd use Expression Is (or whatever it may be called in 2013), and an expression like:

    [ysnShipReady] = True
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    I agree with both Micron and Paul

    OP is not using conditional formatting in his code - so Micron is right so far the code is concerned

    Paul is right about conditional formatting

    OP - see this link about applying conditional formatting - no vba required

    https://support.office.com/en-us/art...ad=US&fromAR=1

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    I interpreted, perhaps wrongly, that the capitalized words Conditional Formatting meant the OP had tried the non-VBA "on the ribbon" approach and failed:

    "I have also tried some Conditional Formatting to disable these fields but it does not seem to work"
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    jdashm is offline Advanced Beginner
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2016
    Posts
    58
    Yes I meant the Conditional Formatting command on the Design Tab ribbon.

  7. #7
    jdashm is offline Advanced Beginner
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2016
    Posts
    58
    If both my VBA and Conditional Formatting are working...
    the VBA is disabling those fields in every record in the continuous forms...
    the Conditional Formatting command just doesn't seem to work at all.
    I am using the criteria you mentioned ([ysnShipReady] = True).
    Any ideas about how I can get this to work.

    Thanks.

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    The VBA won't work. The ribbon option should. Can you attach the db here?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  9. #9
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,803
    Quote Originally Posted by pbaldy View Post
    I'm going to disagree. Conditional Formatting will format controls in different records differently based on the condition. That's its purpose in life. As long as your controls are textboxes, you should be able to disable them conditionally. You'd use Expression Is (or whatever it may be called in 2013), and an expression like:

    [ysnShipReady] = True
    Access does not distinguish between a control on one record versus another...
    I think you misinterpreted my intent (and maybe I didn't express it very well either). I meant you cannot apply a conditional format to a control and expect it only applies to a single record. It applies to all.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  10. #10
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    I'll agree if you mean with VBA code.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  11. #11
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,803
    If you can assign a conditional format to any field and it only works on one record (and not any other record with the same value) I'd truly like to learn how to do that, regardless of how it's done.

  12. #12
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    It can be done with Conditional Formatting, on the ribbon. See the link Ajax posted above. I've used it many times.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  13. #13
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Oh wait, you said "not any other record with the same value"? You'd have to include a reference to that record or something. Maybe I've misunderstood what you've been saying. I'm hip deep in a SQL Server problem.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  14. #14
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,803
    I can tell you with 99.5% assurance that it cannot be done. I've tried to solve this issue in several ways with underlying controls and other tricks. Whatever you do to one control applies to all of the records for that control.

  15. #15
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Can you clarify the specifics or post a sample db? I respect your knowledge so I'm not disagreeing with you, but I don't think I'm understanding your situation. You can certainly conditionally format a form such that some records are affected and others not, based on your condition.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Conditional Formatting in a Access Form
    By adillpickle in forum Forms
    Replies: 3
    Last Post: 01-26-2016, 10:55 AM
  2. Replies: 4
    Last Post: 09-25-2015, 07:28 AM
  3. Conditional Formatting in Access
    By Triland in forum Access
    Replies: 29
    Last Post: 01-18-2013, 01:00 PM
  4. Replies: 2
    Last Post: 12-22-2012, 07:49 AM
  5. Replies: 7
    Last Post: 10-01-2012, 07:59 AM

Tags for this Thread

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