View Full Version : Attendance data type


DGU
04-19-2007, 02:56 AM
Hello everyone, I am buiding up a database for activity school. Here first step of buiding the base, I got an attendance data type problem. i am now using "yes/no", but if i want to query about the number of student each class, is that possible?

Thank you for your help.

neileg
04-19-2007, 03:02 AM
Yes is stored as -1 and No as 0. So if you do a sum on the yes/no field and remove the minus using Abs(), you have the total in attendance.

DGU
04-19-2007, 03:42 AM
Thanks Neileg. So I can't use Yes/No, it is better to use 0 and 1?

DGU
04-19-2007, 04:20 AM
sorry i am a newbie, i can see if i change the data type from "yes/no" into "number", it changes to -1 and 0. So I can calculate with "yes/no" type. Thanks!

neileg
04-19-2007, 04:57 AM
The penny has dropped, I see!

The yes/no datatype isn't really a datatype at all. As you have seen, it's really a number. The same is true of the date/time. If you view it as a number, the date part is the integer and the time is the decimal fraction.

The_Doc_Man
04-19-2007, 05:17 AM
If you have studied languages that use the term CAST (or TYPECAST), then this statement will make sense to you.

Yes/No fields (a.k.a. Boolean when in VBA) are casts of type BYTE.

Date fields are casts of type DOUBLE.

Currency is a scaled cast of type OCTAWORD (which Access does not support as such, but supports the cast. Go figure.)