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

x
?
Solved

decimal place for MS Access byte data type

Posted on 2013-06-22
7
Medium Priority
?
715 Views
Last Modified: 2013-06-23
guys, just a silly question. i want to save the amount of space for each record and i just need to store the number of hours a staff works a day. it would be like 8.75, 5.42 or soemthing like that. 2 DP essentially.

i know that memory is cheap nowadays but just for moot sake ok if yal don't mind.

in the screen shot below, it shows that for byte data type i can choose number of decimal places. i choose 2 and when i go to my table and key in 2.35 it shows up as 2.

1) is there any way i can use byte to store really small decimal places? byte takes 1 byte whereas single takes 4 bytes.
2) if i want to store decimal places the smallest data type is single right? when would you use decimal? it takes 14 bytes.

thanks guys!!

field properties for byte
0
Comment
Question by:developingprogrammer
7 Comments
 
LVL 58

Assisted Solution

by:Jim Dettman (Microsoft MVP/ EE MVE)
Jim Dettman (Microsoft MVP/ EE MVE) earned 400 total points
ID: 39268106
<<
1) is there any way i can use byte to store really small decimal places? byte takes 1 byte whereas single takes 4 bytes.
>>

 A byte can only represent whole numbers from 0 - 255 unless you scale it (multiply/divide by a factor of 10).

<<
2) if i want to store decimal places the smallest data type is single right? when would you use decimal? it takes 14 bytes.
>>

 Single is a floating point number, which if you want accurate decimal places, you don't want to use.

  Either use Currency (a scaled integer to four decimal places) or Decimal (still a scaled integer, but you can specify the scale).

Jim.
0
 
LVL 26

Assisted Solution

by:jerryb30
jerryb30 earned 400 total points
ID: 39268140
I would store time worked as a a value of 1-240, with each number 1/10th of an hour for a 24-hour day. Or, whatever granularity you want, if you presume no one would work more than n hours per day.
0
 
LVL 52

Assisted Solution

by:Gustav Brock
Gustav Brock earned 400 total points
ID: 39268272
As you are only summing the hours, Single could do, but I would use Currency.

/gustav
0
Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

 
LVL 24

Accepted Solution

by:
Bitsqueezer earned 800 total points
ID: 39268655
Hi,

you maybe can set the option to 2 decimal places but as Byte is an integer value it will simply be ignored (sadly enough that Access does not hide such options in those cases, unfortunately Microsoft takes more time to insert silly features into Access than redesign some old but important editors).

You should think about the purpose and importance of any field, not only memory or data type. If you want to save the number of hours it is very important that the values will be saved very exactly because if there would be an error because of the data type the people would not be very amused..
So the minimum is to use Double as datatype, better is to use a solution like from jerryb30, because in this case you have saved the value as integer value which is 100% exact. That would only mean a little more work in the frontend where you must convert the value to a decimal format for output to the user and then back if the user enters a value (and conversion always has a little risk of losing data). So the simplest and most accurate way in my eyes would be to use currency as data type - no conversion and completely exact for the case of 2 decimal places.

By the way: You have still three fields for category in your table...;-)

Cheers,

Christian
0
 

Author Comment

by:developingprogrammer
ID: 39269220
superb!! thanks so so much guys! now i understand this a lot better! i've decided to use integer cause it uses 2 bytes only and i can definitely store all the minutes i need and secondly it's a common denominator for other types of time storage like break time minutes or lunch minutes instead of break time being 15min and hours worked being 8 hours. so now everything's in minutes. thanks guys!! = ))
0
 

Author Comment

by:developingprogrammer
ID: 39269221
and bitsqueezer thanks so much for confirming that MS Access didn't remove that really confusing decimal thing for byte data type in their field properties!! = ))
0
 
LVL 24

Expert Comment

by:Bitsqueezer
ID: 39269241
;-)
You're welcome.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
If you’re using QODBC to update QuickBooks data from Microsoft® Access but Access is not showing the updated data, you could have set up QODBC incorrectly.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question