From: Jenn on 17 Mar 2010 13:09 I have a field set up with number datatype and percent format. I am trying to enter 30% and it comes up 0%. When I put in .30 I get 0% when I put in 300 I get 300%. I can't get this field to show 30%. I need it to be a number because I want to multiply it by another number in a query. Please help.
From: KenSheridan via AccessMonster.com on 17 Mar 2010 14:07 You are apparently using an integer number data type (a long integer is the default data type for a number when you create a table). If you want to enter the value as a decimal fraction such 0.3 change the 'Field Size' property to Single in the table design and format it as a percentage. The reason that 30% shows As 0% that entering a percentage sign divides the value by 100, so it becomes 0.3. As\the field is an integer data type this is rounded down to zero. If you want to enter the number as an integer, e.g. 30 then use an integer data type, but don't format it. Instead, in a form or report add a label with the % sign immediately to the right of the control. In a report you can display it as a percentage in the same way or by setting the ControlSource of a text box control to =[PercentField] & “%”, or =Format([PercentField]/100, ”Percent”). Not seeing the percentage sign in the table in raw datasheet view is immaterial as the data should only be exposed to the user in a form or report. If you do use an integer then you'll need to take account of this in any expressions, e.g. to compute the percentage of another field's values: =[Amount] * ([PercentField]/100) Ken Sheridan Stafford, England Jenn wrote: >I have a field set up with number datatype and percent format. I am trying >to enter 30% and it comes up 0%. When I put in .30 I get 0% when I put in >300 I get 300%. I can't get this field to show 30%. I need it to be a >number because I want to multiply it by another number in a query. Please >help. -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access/201003/1
|
Pages: 1 Prev: Subform as datasheet question Next: Need help with a query |