Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Condition Specific Checkbox
Sean Sweeney 
     
4 years ago
I have a normalized dropdown for 'license status' (Active, Expired, Inactive, Duplicate, Pending, etc). I was wondering if it was possible to relate specifically "active" to a checkbox in an employee record table, and have all of the other entries relate to the field being unchecked/no?
Kevin Robertson  @Reply  
          
4 years ago
You could use an AfterUpdate event to set the Checkbox to True if Active is selected, otherwise set it to False.
Sean Sweeney OP  @Reply  
     
4 years ago
I feel like I'm overlooking something obvious. I'm getting interaction between the field and the yes/no checkbox. However, it only seems to be going from unchecked to checked and not the other way. I was having issues with block statements, so I just ended all of my if statements - I'm sure there's probably a better way of writing this. I've also tried with yes, no, true, false, parentheses, and quotations and I'm not having luck. I feel like I'm missing something super obvious but I'm missing it because it's 2 AM and I'm running out of steam. Here's my code, as of now:

_AfterUpdate()
    If Me.LicenseStatus.Value = "Expired" Then
    Me.IsActive = "0"
    End If
    If Me.LicenseStatus.Value = "Terminated" Then
    Me.IsActive = "0"
    End If
    If Me.LicenseStatus.Value = "Active" Then
    Me.IsActive = "-1"
    End If
End Sub

I have a couple of other false statements - pending, duplicate, inactive, etc - but all of the code didn't want to fit on this form.
Kevin Robertson  @Reply  
          
4 years ago
It isn't stated in the code you are using. It is the AfterUpdate event for the Combo Box?

If you only have one column in your Combo Box.
If LicenseStatus = "Active" Then
   IsActive = True
Else
   IsActive=False
End If


If you have multiple columns where the first column is the ID (Assuming the ID for Active is 1)
If LicenseStatus = 1 Then
   IsActive = True
Else
   IsActive=False
End If


or reference the column of the Combo Box.
If LicenseStatus.Column(1) = "Active" Then
   IsActive = True
Else
   IsActive=False
End If
Sean Sweeney OP  @Reply  
     
4 years ago
Kevin!

You called it! I forgot since I'm in the process of moving from data that is not normalized to normalized, I have a field with license status as short text, then I have a separate with foreign integers. Once everything is merged then I will delete the short text field. Once I sorted out that mess, your first line of code worked immediately without changing a single thing.

I guess that's the trouble with trying to blend the new with the old - exceedingly easy to overlook one thing or focus on the wrong field.

Thanks again! I kind of feel stupid about such an oversight. I was getting ready to experiment with tags and oncurrent triggering a requery. I'm glad it didn't come to that!
Sean Sweeney OP  @Reply  
     
4 years ago
I'm trying to trigger a checkbox in a different table based on the date. Not sure if it should Form_Current or On_Load, but I was trying to get a checkbox to automatically change the checkbox to false after the date entered in the "ExpDate" Field.

    If ExpDate <= Date Then
        CompanyIsActive = True
    Else
        CompanyIsActive = False
    End If
Adam Schwanz  @Reply  
           
4 years ago
I would use the on current event, it allows you to navigate to another record and have the code fire for the checkbox still. On load would only go off if the form was closed and re-opened. In this case, on current just gives you more options ;).
Sean Sweeney OP  @Reply  
     
4 years ago
Awesome, Thanks Adam!

I will for sure use on current! I did consider that and thought I would add a DoCmd save to the function when I get it to work - but On Current sounds like it would work best.

Is there something wrong with my code? Not getting a trigger in CompanyIsActive when I've been changing the ExpDate to test to see if the function would work. Unlike with my initial post, I did make sure I was addressing the correct fields - no redundant normalization issues here. :-p
Adam Schwanz  @Reply  
           
4 years ago
On current doesn't check for changes and fire for no reason, that would be an on-timer event to check if something had happened (a value being added to a field) and executing the code then.

But in this case, you probably just need an after update event in the ExpDate field, so after you put a value in that field it will fire the code too for checking the checkbox. You can use the same code you have already. So put your date in and press tab and the after update event will fire and do the checkboxes. Then anytime you navigate back to this record the on current event will fire and check the checkbox for you.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 6/17/2026 10:41:46 AM. PLT: 0s