Results 1 to 2 of 2
  1. #1
    Kiwidude23 is offline Novice
    Windows 10 Access 2007
    Join Date
    Oct 2016
    Posts
    1

    Toggle Buttons Programming


    Hi, I have a very specific (probably basic) programming query - I am setting up a student number recognition test on Access where I would like to use toggle buttons to enable teachers to quickly and easily identify what students have incorrect and correct (easy part already done). But in order to make this more useful, I was wondering if it is possible to, when a toggle button is on add 1 point to another field (eg "TotalScore") when it is off to add 0. Giving an overall score along side the visual "On/Off".

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    if using a checkbox or toggle button then the values are stored as numbers - 0=false/no, -1=true/yes, so you can just add them up and multiply by -1 to convert to a positive number (or use the abs function)

    note that in a continuous form the button should be bound or you would need to use some code in the button after update event.

    Have an unbound txtTotal control in the form header or footer

    in the button control after update event put

    Code:
    if btnControl then
        txtControl=txtControl+1
    else
        txtControl=txtControl-1
    end if
    ensure all buttons are defaulted to 0 when the form opens

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

Similar Threads

  1. Replies: 21
    Last Post: 06-03-2015, 07:14 PM
  2. Replies: 4
    Last Post: 05-29-2015, 09:36 AM
  3. Filtering Subform with Toggle Buttons
    By doubleohkevin in forum Forms
    Replies: 3
    Last Post: 09-30-2014, 02:13 PM
  4. Shape Effect on Toggle Buttons
    By dimoc in forum Access
    Replies: 5
    Last Post: 04-10-2014, 09:28 AM
  5. Replies: 1
    Last Post: 06-16-2012, 02:50 PM

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