If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#21
|
|||
|
|||
Format number field to show Percent
The code works! Thank you Clifford!
"Clifford Bass" wrote: Hi Kaylen, Try this instead: If Not IsNull(controlname) And Right(controlname, 1) "%" Then controlname = controlname / 100 End If Clifford Bass "Kaylen" wrote: I have used John's code to make the number divided by 100. But there is no percent sign after the number. I would like to enter 10 and the value become 10%. Any suggestion? This is the code I tried to put in the after update field of a number field: Private Sub controlname_AfterUpdate() If Me!controlname 1.0 Then ' don't change unless it needs changing Me!controlname = Me!controname / 100 End If End Sub "Jeff Boyce" wrote: Kaylen Fred's comments remind me that percentages represent ratios. If you store percentages, do NOT give in to the temptation to "do math" on the percentages. After all, wouldn't it be simple to average 25%, 50% and 75% and come up with an average percentage of 50%? Yes, it would be easy. No, it wouldn't (necessarily) be correct! Since each percentage is one number divided by another, the ONLY way you could legitimately average the percentages is if you were dividing by the SAME number to calculate each percentage. Good luck! Regards Jeff Boyce Microsoft Office/Access MVP "Kaylen" wrote in message ... Thank you everyone for your inputs and suggestions. For my database, the percentages range from 0% to 100% only. I will try the code that John suggested. Thank you for your expertise! "Fred" wrote: Mathematically, percent is a way of expressing a comparison between TWO numbers, with a mathematical definition and symbology (% sign) to give it context/definition. Or, a way to specify an operation to be performed on a not-yet-specified number (i.e. 50% = multiply that not-yet-specified number by .50). Percentages regarding changes in numbers need more context explanation, i.e. "10% markup" can mean either multiply by 1.1 or divide by .9, two different answers. If there is going to be a mathematical answer, Kaylan will have to clarify the question mathematically. Otherwise it can be anything, it's probably just the entered number with a % sign appended to it, could even be just a text field. If 2007 enables this on a numeric field, it is only adding to the confusion. |
#22
|
|||
|
|||
Format number field to show Percent
On Mon, 26 Jan 2009 10:11:30 -0800, Ken Sheridan
wrote: With Access 2007 I believe all you have to do is set the control's Format property to Percent. That is what I had not realized. That certainly makes it simpler than my suggestion! -- John W. Vinson [MVP] |
#23
|
|||
|
|||
Format number field to show Percent
Thank you for everyone' s help and suggestions. I am able to format the
number to Percent the way I would like to! Thank you all for being so helpful! "Fred" wrote: In light of the above discussions, the following two ideas might not be as dumb as they sound: - Put the % sign into the body of the form next to the field (i.e. not in the field) - Make it a text field and put code in to add a % sign to the end of whatever you type in. |
#24
|
|||
|
|||
Format number field to show Percent
Hi Kaylen,
You are welcome! Clifford Bass "Kaylen" wrote: The code works! Thank you Clifford! "Clifford Bass" wrote: |
Thread Tools | |
Display Modes | |
|
|