Results 1 to 6 of 6
  1. #1
    TrevorThielen is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2011
    Posts
    17

    I have 5 check boxes and want to calculate a percentage...

    So I have 5 check boxes called Act1, Act2, Act3, Act4,Act5 and I want to calculate a number (100 when all checked) in another field called percentcomplete. How would that work?




    Thanks in advance!

    Access 2007

  2. #2
    pdebaets is offline Competent Performer
    Windows Vista Access 2010 (version 14.0)
    Join Date
    Jul 2010
    Location
    Los Angeles
    Posts
    235
    in the form OnCurrent event procedure and each checkbox AfterUpdate event procedure put

    percentcomplete = abs(Act1 + Act2 + Act3 + Act4 + Act5)/5

    You also may want to consider putting this code in a function, then call the function from the event procedures indicated above.

  3. #3
    TrevorThielen is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2011
    Posts
    17
    Perfect! How about if each Act has a different weight? Say Act 1 = 10% and Act 2= 35%?

    Thanks again!

  4. #4
    pdebaets is offline Competent Performer
    Windows Vista Access 2010 (version 14.0)
    Join Date
    Jul 2010
    Location
    Los Angeles
    Posts
    235
    You could put the weight for each in the tag property of each checkbox control. Using 10 for 10 percent, you could calculate:

    percentcomplete = (cint(Act1.tag) + cint(Act2.tag) + cint(Act3.tag) + cint(Act4.tag) + cint(Act5.tag))/100

  5. #5
    TrevorThielen is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2011
    Posts
    17
    I'm probably wearing out my welcome on this subject... But what if I wanted a different weight for Act1 depending on the type of main tag number. For example: If TagType=1 then Act1=10, but if TagType=2 then Act1=15. I thought about making more fields, Weight1 Weight2.... then setting the value of them fields after updating the check box Act 1. I'm sure this would be easy in VBA code, I'm just not that experienced with VBA.

    I swear this will be my last question on this subject... lol

  6. #6
    TrevorThielen is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2011
    Posts
    17
    Got it figured!

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

Similar Threads

  1. Calculate Percentage based on previous column
    By VictoriaAlbert in forum Queries
    Replies: 1
    Last Post: 08-13-2011, 01:30 PM
  2. Replies: 5
    Last Post: 12-17-2010, 11:06 AM
  3. To check or Un-Check all Boxes in a form
    By devcon in forum Forms
    Replies: 7
    Last Post: 05-01-2010, 12:03 AM
  4. How to calculate a percentage on form
    By jrockusa in forum Forms
    Replies: 1
    Last Post: 03-31-2010, 01:53 PM
  5. Use report to Calculate sum and percentage
    By bangemd in forum Reports
    Replies: 3
    Last Post: 05-28-2009, 12:01 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