Results 1 to 6 of 6
  1. #1
    Summit_IT is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jan 2019
    Location
    Virginia
    Posts
    47

    Checkbox in form = TRUE when other Checkboxes on form = TRUE


    I have a form that has a number of checkboxes to indicate the status of a part (Record). I want the "PartNeeded" checkbox to change from (Default)False to True when [FailedVisual] = True Or [FailedNDI] = True Or [PartMissing] = True.

    Compiling the following code doesn't show any errors, but it doesn't work. Right now, it's under Form_Load.

    Code:
    If [FailedVisual] = True Or [FailedNDI] = True Or [PartMissing] = True Or [Retired] = True Then [PartNeeded].Value = True
    I bet there is a simpler way of doing this.

    Thanks in advance!

  2. #2
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,914
    So what happens when you move to another record?
    Try the Current Event.

    I would just use PartNeeded = True
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  3. #3
    moke123's Avatar
    moke123 is online now Me.Dirty=True
    Windows 11 Office 365
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,651
    Assuming that you want the value to change when you check off one of those options you would need to call that code from each checkbox.
    I'd create a separate procedure and then call it on current of the form,as well as on afterupdate of each checkbox.

    I'd also suggest using the Me. keyword as in Me.PartMissing, etc.
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

  4. #4
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,793
    That procedure would have to be a function and not a sub if I'm thinking along the same lines. However, I don't see what's wrong with that code line, but "doesn't work" doesn't help much. If all of the controls are bound, what would you need the current event for? That's a missing puzzle piece? As for that code being simpler
    If [FailedVisual] Or [FailedNDI] Or [PartMissing] Or [Retired] Then [PartNeeded] = True
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  5. #5
    Summit_IT is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jan 2019
    Location
    Virginia
    Posts
    47
    Putting the code under Current Event was the winner. It works the way I want it to.

    Thanks

  6. #6
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,914
    Quote Originally Posted by Summit_IT View Post
    Putting the code under Current Event was the winner. It works the way I want it to.

    Thanks
    My thoughts were as you went from record to record?, but if you amend any of those criteria controls, then then PartNeeded is not going to change to reflect that, unless you move off that record and then back to it?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

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: 7
    Last Post: 08-02-2016, 01:19 PM
  3. Replies: 1
    Last Post: 03-27-2016, 10:29 PM
  4. On Click event filter By checkbox = True
    By nick404 in forum Programming
    Replies: 14
    Last Post: 06-05-2015, 03:08 PM
  5. if checkbox= true subtract 8.75 from A to=B
    By VanillaAwesome in forum Queries
    Replies: 6
    Last Post: 07-28-2012, 12:48 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