Change decimals displayed based on input (1 Viewer)

chuckcoleman

Registered User.
Local time
Today, 09:22
Joined
Aug 20, 2010
Messages
363
Hi, I have a form and the user can enter either a whole number, i.e. 6, or a decimal number, i.e. 4.25. That data is used in a report. When the report is created, if the user entered a whole number, I want just the whole number displayed, i.e. 6. If it is a decimal number, I want the decimal number displayed, i.e. 4.25. Right now, if a whole number is entered, I get 6.00.

How can I display in the report 6 or in the case of a decimal number, 4.25?

Your help is appreciated,

Chuck
 

Tieval

Still Clueless
Local time
Today, 15:22
Joined
Jun 26, 2015
Messages
475
In the table store the number as a double.

If you do this it should all work without any effort as attached.
 

Attachments

  • Database1.accdb
    480 KB · Views: 83

chuckcoleman

Registered User.
Local time
Today, 09:22
Joined
Aug 20, 2010
Messages
363
Thank you. I had the Format in my Form and Report set to Standard vs. General Number. The reason I set it to Standard was so I would get comma's if the number was larger than 999. Changing it to General Number solved my initial request but I lose the comma's. Any thoughts on how to retain the comma's?

Chuck
 

Tieval

Still Clueless
Local time
Today, 15:22
Joined
Jun 26, 2015
Messages
475
I think you are out of luck:

General Number: Display the number as entered.

Standard: Use the thousand separator; follow the settings specified in the regional settings of Windows for negative amounts, decimal symbols, and decimal places.

You can (I think) only change the number of decimal places to a set amount so if you use standard for the commas you cannot have a random number of decimal places.

It can be done by displaying a string generated from the number in the table but is a lot of work, have to ask why do you want to do this as to me random length number mis-aligned by varying amounts of decimal places looks ugly.
 

Users who are viewing this thread

Top Bottom