Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / July 2006

Tip: Looking for answers? Try searching our database.

Floating Decimal in MS Access 2003

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
robboll - 30 Jul 2006 00:32 GMT
At least I think it may be referred to a as a floating decimal.  I have
an input form that has a single where a user can enter data as follows:

12345 or 12345.67 or Text

When the user enters the value, he also selects a radio button
indicating whether it is a whole number, currency (with decimals) or if
it is text.

The problem is that when I use the format function:
Format([Numbers],"$#,##0.00") with an integer where I don't want
decimals -- decimals are included anyway. (i.e., 12345.00).

How I solved the problem is with this IIF statement:

Table1 Structure:
Field: Numbers, Text, 50

SELECT Table1.Numbers,
IIf([Numbers]-Int([Numbers])<>0,Format([Numbers],"$#,##0.00"),Format([Numbers],"#,##0"))
AS Result
FROM Table1;

Is there a simpler, better way to do this?

Thanks for any tips.

RBollinger
onedaywhen - 31 Jul 2006 09:38 GMT
> When the user enters the value, he also selects a radio button
> indicating whether it is a whole number, currency (with decimals) or if
> it is text.

You should not be using one column for text AND integers AND currency.
You should not be using a column name 'numbers', especially one that
contains text. Post your validation rules for this column and maybe
someone can figure out what you are trying to achieve.

Jamie.

--
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.