Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Text box rounding numbers 2

Status
Not open for further replies.

hefly

Technical User
Feb 6, 2008
134
US
I have a textbox on a form that is rounding.
In both my table and on my form, I have format set to standard and fixed decimal points.

The data type in my table is set to double, and 4 place decimal points.

I enter 1.6666 and the number displays as 2.0000

How can I stop this rounding?

Thanks.

Hefly
 
I would double check the data type of the field. The default is Long for numeric. It seems this is your issue.

Is the record source of the form a table or query?
Is the control source a field or result of a calculation?

Duane
Hook'D on Access
MS Access MVP
 
Thank you dhookom. I will have to check this on Monday. My data source is a query and not a result of a calcualtion.

I changed both the data type in my table from long to double.

Maybe if I remove the query... ?

Hefly
 
Even though the form displays it as a whole number, check the table datasheet view to see how it is stored. Maybe copy and paste the value into another app such as Excel or even Notepad.

Duane
Hook'D on Access
MS Access MVP
 
If you switch the record source from a query to the table and the problem is fixed, then your query is formatting the number.

It is generally good practice to base your form on a query instead of a table. So you may want to keep that query in place and adjust the formatting. In query design view, right click on the field and select properties, and you'll see familiar options for number format.

[purple]If we knew what it was we were doing, it would not be called
research [blue]database development[/blue], would it? [tab]-- Albert Einstein[/purple]​
 
GKChersterson: That did the trick. I changed the field name from tblName.* to the individual field names of the table and set the query properties on the offending field name. That resolved the issue.

Thanks!

Hefly
 
I am not aware of a query changing the data type or display without the developer applying some type of formatting or calculation to the field. I create almost all of my forms based on queries or SQL statements with no issues with rounding.

I always want to limit the displayed records and display them in a specific order. Some times I want to include another table in the Record Source. This functionality is easily provided by a query or SQL statement.

Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top