Hi all,
I would like to know how do you go about calculating percentages in Access.
For example, in a form I have 3 combo boxes with drop down menus where a user can select "Yes" or "No" and a text box where I will calculate a percentage. What I am looking for is something like this:
If combo1 = "yes" then percentagebox = 1 / 3 * 100
ElseIf combo1 AND combo2 = "Yes" then percentagebox = 2 / 3 * 100
ElseIf combo1 AND combo2 AND combo3 = "Yes" then percentagebox = 3 / 3 * 100.
Can anyone tell me how can I go about creating and calculating percentages such as this in Access? I appreciate any help.
Thanks
9 27638
I think you need to tell us a little bit more about exactly what you're trying to accomplish, AZKing. I have to tell you, what you've posted so far sounds as if you're trying to swat a fly with an atom bomb!
Ok, I am trying to do the following:
In a form in Access, I have 3 drop down menus where you can select "yes" or "no". I also have a text box where I would like a percentage to show up based on the answers of the 3 drop down menus. For example, if in drop down menu 1 "yes" is selected, I would like 33.3 % to show up in the text box. If in drop down menus 1 and 2 "yes" is selected, I would like 66.7 % to show up in the text box. If in drop down menu 1, 2, and 3 "yes" is selected, I would like 100 % to show up in the text box.
Is this a little more clear?
I would appreciate any help. Thanks.
Hi all,
I would like to know how do you go about calculating percentages in Access.
For example, in a form I have 3 combo boxes with drop down menus where a user can select "Yes" or "No" and a text box where I will calculate a percentage. What I am looking for is something like this:
If combo1 = "yes" then percentagebox = 1 / 3 * 100
ElseIf combo1 AND combo2 = "Yes" then percentagebox = 2 / 3 * 100
ElseIf combo1 AND combo2 AND combo3 = "Yes" then percentagebox = 3 / 3 * 100.
Can anyone tell me how can I go about creating and calculating percentages such as this in Access? I appreciate any help.
Thanks
I think what you are looking for is the Format() Function in which an Expression can be properly formatted to produce a Percentage as in: - Format$(1/4,"Percent") ==> 25.00%
I think what you are looking for is the Format() Function in which an Expression can be properly formatted to produce a Percentage as in: - Format$(1/4,"Percent") ==> 25.00%
Hi, I'm not sure I understand, can you please give me an example?
Thanks.
NeoPa 32,534
Expert Mod 16PB
What happens if Combo2 is selected on its own?
Your question is not very clear in this respect. What is the idea behind this? That may help to understand where you're coming from.
What do you have on your form at the moment? :confused:
What happens if Combo2 is selected on its own?
Your question is not very clear in this respect. What is the idea behind this? That may help to understand where you're coming from.
What do you have on your form at the moment? :confused:
Well, I'm gonna freeze or make not visible combo2 and combo3 if combo1 is not selected, same with combo3, I will freeze it or make it not visible if both combo1 and combo2 are not selected, which will remove the possibility of this occuring.
The idea behind this is to calculate the percentage of work completed. So if combo1 is selected as completed, than the percentage should be 33.3 %; if combo1 and combo2 are selected as completed, than the percentage should be 66.7 %; and if combo1, combo2, and combo3 are selected as completed, than the percentage should read 100 %. I hope this is a little more clear.
Any suggestions?
NeoPa 32,534
Expert Mod 16PB
This code will show the percentage required but as text. - Private Sub Combo1_AfterUpdate()
-
Call TextSource
-
End Sub
-
-
Private Sub Combo2_AfterUpdate()
-
Call TextSource
-
End Sub
-
-
Private Sub Combo3_AfterUpdate()
-
Call TextSource
-
End Sub
-
-
Private Sub TextSource()
-
If Me!Combo3 = "Completed" Then
-
Me!percentagebox = "100.0%"
-
Elseif Me!Combo2 = "Completed" Then
-
Me!percentagebox = " 66.7%"
-
Elseif Me!Combo1 = "Completed" Then
-
Me!percentagebox = " 33.3%"
-
Else
-
Me!percentagebox = " 0.0%"
-
End If
-
End Sub
If you already have code (I suspect you do) in the AfterUpdate event procedures of your ComboBoxes then just incorporate this call into it.
This code will show the percentage required but as text. - Private Sub Combo1_AfterUpdate()
-
Call TextSource
-
End Sub
-
-
Private Sub Combo2_AfterUpdate()
-
Call TextSource
-
End Sub
-
-
Private Sub Combo3_AfterUpdate()
-
Call TextSource
-
End Sub
-
-
Private Sub TextSource()
-
If Me!Combo3 = "Completed" Then
-
Me!percentagebox = "100.0%"
-
Elseif Me!Combo2 = "Completed" Then
-
Me!percentagebox = " 66.7%"
-
Elseif Me!Combo1 = "Completed" Then
-
Me!percentagebox = " 33.3%"
-
Else
-
Me!percentagebox = " 0.0%"
-
End If
-
End Sub
If you already have code (I suspect you do) in the AfterUpdate event procedures of your ComboBoxes then just incorporate this call into it.
Thank you very much, it worked great!!! I was very close myself, I just couldn't get it to work properly. I appreciate your help and input and thanks again :)
NeoPa 32,534
Expert Mod 16PB
Glad I could help.
Hopefully you see the concept and that's now something you'll be able to do in future :)
Sign in to post your reply or Sign up for a free account.
Similar topics
by: michael |
last post by:
I've got a 3-column layout using percentages to define width of each
div-column.
#left-col { width: 20%; background-color: green; float:left; }
#center-col { width: 60%; background-color: blue;...
|
by: richard |
last post by:
I have a table with 5 fields into which the user will enter numbers,
which must add up to 100%. Say the fields are Toyotas, Missans, Mazdas,
Hondas and Other. I am having trouble writing a query...
|
by: Mike Barnard |
last post by:
Hi all.
I am playing with html and css. I don't (yet) have a working site,
I'm just trying to build a working, basic template I can use for a
couple of ideas I have.
I recall reading a...
|
by: Jurek |
last post by:
I have 10+ experience in C/C++ - mostly automation and graphics. I have
never written any business apps though. Recently I've been asked to write a
simple report that would calculate sales...
|
by: Umesh |
last post by:
Plese help. Is there any software by which we can do that?
|
by: Dineo |
last post by:
Hi there
I've created a database and a pivot table but I need to calculates percentages of all the WithdrwalAmt (the amount being withdrawn when retire) per PayeeName (where the money was invested...
|
by: Libber39 |
last post by:
Hi everyone,
Have a query on how to calculate the amount of weeks and days contained in a number in an access query. ie: the difference in days between 2 dates amounts to 17 days. I want to now...
|
by: martin DH |
last post by:
Access 2003
I have a table (TASKS) filled with data from an external source. The table lists several tasks for employees to complete and has a text field (STATUS) that identifies where in the...
|
by: buddyr |
last post by:
Hello,
can I write a query that will give percentages of records in one field?
table example:
table1
IdNumber model condition
01 045 good
01 045 ...
|
by: Rina0 |
last post by:
Cybersecurity engineering is a specialized field that focuses on the design, development, and implementation of systems, processes, and technologies that protect against cyber threats and...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM)
The start time is equivalent to 19:00 (7PM) in Central...
|
by: linyimin |
last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
|
by: erikbower65 |
last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA:
1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
|
by: kcodez |
last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
|
by: DJRhino1175 |
last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this -
If...
|
by: DJRhino |
last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer)
If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _
310030356 Or 310030359 Or 310030362 Or...
|
by: lllomh |
last post by:
Define the method first
this.state = {
buttonBackgroundColor: 'green',
isBlinking: false, // A new status is added to identify whether the button is blinking or not
}
autoStart=()=>{
|
by: DJRhino |
last post by:
Was curious if anyone else was having this same issue or not....
I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
| |