I just noticed that Yes/No field (e.g. in Table Design view) is defined as one bit long, while VBA boolean data type is two bytes. That's pretty a big difference for a simple variable that is supposed to only have two states.
I am not at all concerned about the typecasting or anything like that as it obviously was not a problem for numbers of developers, myself included.
However, it does poses two questions:
1) How did they define Yes/No to be one bit? If I'm not mistaken, normally computers works in sets of 8 bits (e.g. bytes), so having any data types that isn't a factor of 8 bits would variably be expanded/truncated to be a factor of 8. What ramifications does it hold?
For example, does that mean we could have up to 8 Yes/No fields without any increase in the table's size per row? (Speaking of which, is there a way to calculate how much space per row in a given table takes?)
Or did they really to manage to be able to handle one bit, meaning that whenever a table has 8 new rows, we've had added a byte to the total table size?
2) Why have two bytes for VBA's boolean, when one byte is actually just enough for the job? Heck, why not one bit as Yes/No field seems to be capable of? Does it then follow that if we used Byte data type (which takes just one byte) and treated it as a boolean, we would be saving a byte? AFAICT, we can use any numeric data type and treat it as boolean without any problem, so substituting a Byte data type for a Boolean data type would make more sense, especially if we were going to use it in several places or repeatedly.
The only problem, of course, is that Byte is unsigned while we normally use -1 for True/Yes/whatever.
I had expected that this would already been discussed to death by MVPs long ago- if anyone happens to know if there's such thread, I'll appreciate the link.
I am not at all concerned about the typecasting or anything like that as it obviously was not a problem for numbers of developers, myself included.
However, it does poses two questions:
1) How did they define Yes/No to be one bit? If I'm not mistaken, normally computers works in sets of 8 bits (e.g. bytes), so having any data types that isn't a factor of 8 bits would variably be expanded/truncated to be a factor of 8. What ramifications does it hold?
For example, does that mean we could have up to 8 Yes/No fields without any increase in the table's size per row? (Speaking of which, is there a way to calculate how much space per row in a given table takes?)
Or did they really to manage to be able to handle one bit, meaning that whenever a table has 8 new rows, we've had added a byte to the total table size?
2) Why have two bytes for VBA's boolean, when one byte is actually just enough for the job? Heck, why not one bit as Yes/No field seems to be capable of? Does it then follow that if we used Byte data type (which takes just one byte) and treated it as a boolean, we would be saving a byte? AFAICT, we can use any numeric data type and treat it as boolean without any problem, so substituting a Byte data type for a Boolean data type would make more sense, especially if we were going to use it in several places or repeatedly.
The only problem, of course, is that Byte is unsigned while we normally use -1 for True/Yes/whatever.
I had expected that this would already been discussed to death by MVPs long ago- if anyone happens to know if there's such thread, I'll appreciate the link.