Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 310
  • Last Modified:

Access 2010 - Creating fields in a table - help with field types

As options.
I'm not understanding the specific date types here:
what does the word "single" refer to?  I know it's not single integer.
Please fill in the blank, or supply me with an official MS link that describes these data types.
Single _________
Double _______
Decimal _________
How do I decide which one to use?  
Or should I just use "double" for everything?
0
brothertruffle880
Asked:
brothertruffle880
  • 2
4 Solutions
 
mbizupCommented:
This is not an "official MS Link", but Allen Browne is a very well-respected Microsoft MVP who has done a terrific job of spelling out the different datatypes here:

http://allenbrowne.com/xbase-05.html
0
 
mbizupCommented:
Regarding when you would use one data type over the other... it depends on the values and precision of the numbers you want to store.  As a test, you can add code like the following to a VBA module:

Sub test1()
    Dim I as integer
    Dim x As Single
    Dim y As Double
End Sub

Open in new window


Placing the cursor over the integer, single or double and hitting F1 will give you a quick description of the datatypes -- including allowable ranges.

Singles, for many purposes are arguably better than doubles since they take up less space (and have a range that works for many uses).
0
 
peter57rCommented:
You also need to consider the Currency datatype if you have decimal numbers which require absolute accuracy.

Both Single and double are precise but not accurate - just do 1.7-1.6 in the immediate window to see.
This inaccuracy is due to the inability of binary numbers to represent the fractional part of most decimal numbers.

Currency datatype (which is a special case of the decimal datatype) stores numbers as integers and does run-time conversion to their decimal representation and are accurate to 4 d.p. (do not confuse Currency datatype with Currency Format).
0
 
clarkscottCommented:
Dont' use Decimal for numeric values.  It will display large numbers... but you can't do anything with the values unless you're satisified with scientific notation.  The decimal save data as strings and is used primarily for downloading/importing data from DB or other large databases (mainframes).

Scott C
0

Featured Post

Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now