Results 1 to 6 of 6
  1. #1
    mick3911 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Feb 2013
    Location
    Wirral, UK
    Posts
    66

    Don't display field if checkbox is false

    I have a subform that is designed from a query which contains various fields which are locked and not enabled (i.e. read only).
    One field is a date field (Due Refresher) which has conditional formatting where if the date is less than today the text turns red and another field which is a checkbox (Required).
    What I am trying to do is that when the subform is opened if the checkbox (Required) is False’ then the Due Refresher field is not displayed.
    I have tried the following on the On Open and On Load (separately) but nothing is happening.

    If Me.Required = False Then
    Me.DueRefresher.Visible = False
    Else
    Me.DueRefresher.Visible = True


    End If

    Can anyone help me out please?

  2. #2
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,910
    Walk through the code after setting a breakpoint and see what the values are.

    I would have thought you would want this on the current event if you change a record.?

    You could simplify it to
    Code:
    Me.DueRefresher.Visible = Me.Required
    as well.

    HTH

  3. #3
    mick3911 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Feb 2013
    Location
    Wirral, UK
    Posts
    66
    Hi Welshgasman,

    Many thanks for your reply.

    The record is changed using another form which is changed only by people who have access to it.

    The form I am wanting to only display the Due Refresher date can be seen by anybody but they cannot edit it.

  4. #4
    mick3911 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Feb 2013
    Location
    Wirral, UK
    Posts
    66
    Am I putting the code in the right place?

  5. #5
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,784
    You don't make a form for every permission - you make one form and do things to it accordingly, like lock or hide controls, or make the whole form read-only or whatever. Perhaps I misunderstood but that's what I got out of the above.

    Aside from that, is the checkbox bound? If not, it probably has no value unless someone actually has clicked it at least once. The checkbox is on a subform? If not then which form has your code? A subform loads first, then a main form. You can't check anything about a main form in subform open or load events.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  6. #6
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Assuming that, like most Subforms, you're talking about a Datasheet Form...using the OnLoad or OnOpen event will format all Records going by the Value of Required in the first Record displayed when the Form opens...not each Record appropriately.

    And there is no direct way of using Conditional Formatting to make a Control invisible...you can only Disable it.

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

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

Similar Threads

  1. Table True False Checkbox
    By Tuckejam in forum Access
    Replies: 2
    Last Post: 04-30-2020, 04:47 PM
  2. Replies: 8
    Last Post: 06-27-2019, 02:49 AM
  3. Replies: 3
    Last Post: 03-23-2018, 06:49 PM
  4. Replies: 7
    Last Post: 05-30-2013, 04:22 PM
  5. display image if checkbox is checked
    By Casey Sanders in forum Reports
    Replies: 5
    Last Post: 04-03-2013, 04:49 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