Results 1 to 3 of 3
  1. #1
    matey56 is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Jul 2020
    Posts
    136

    Using checkboxes for calculations

    Hi,


    I have a form with a control that does a simple calculation by adding 18 months to a date in another control. Now I want to give the users the option to check a box for either 12 or 18 months. So depending on which box is checked, the control will add either 12 or 18 months. What's the best way to handle this?

    The formula is currently in the control is: =IIf(IsDate([Date_Driving_18_Month_Expiration]),DateAdd("m",18,[Date_Driving_18_Month_Expiration]),"")

  2. #2
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,793
    I would use an option frame with 2 option buttons. Option labels indicate the value. The chosen option is passed to the frame. The best benefit to this is that if you want to add other values later, you will only have to add options and not change your expression (calculation formula) because the chosen value is always passed to the frame. This is better than one checkbox, which can be checked or not (thus only providing 2 possible values) except where it has never been checked. In that case, it is neither and you would also have to deal with that.

    BTW, the moment you want to pass a variable value to the expression, any solution will have to be handled in code.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    ssanfu is offline Master of Nothing
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Another option would be a 2 field table (NumMonths, txtDescription) and a combo box.

    NumMonths
    txtDescription
    12 12 Months
    18 18 Months

    To add more options, just add to the table.

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

Similar Threads

  1. Use of checkboxes in query
    By GeirA in forum Queries
    Replies: 9
    Last Post: 10-26-2015, 06:17 AM
  2. Replies: 30
    Last Post: 09-30-2015, 10:58 AM
  3. Group by three checkboxes
    By lizzywu in forum Reports
    Replies: 2
    Last Post: 10-12-2011, 09:22 PM
  4. Checkboxes ?
    By Trojnfn in forum Access
    Replies: 3
    Last Post: 09-30-2011, 01:52 PM
  5. Clear all checkboxes?
    By thekruser in forum Forms
    Replies: 2
    Last Post: 09-16-2010, 09:50 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