December 11th, 2002, 12:04 PM
Boolean Data Type Help
Is there any way to create a field with variable Yes/No or Boolean type? I'm creating Access tables on the fly which contain the same structure as someone else's tables, at his request. The problem is is that he has this Yes/No data type field.
Any help would be appreciated.
December 11th, 2002, 12:12 PM
Setting a boolean field to Yes/No or True/False in Access is simply a matter of setting a property for that field. When you create the table there's a property box at the bottom of the form that allows you to set properties for each field. That is where you would set it to Yes/No. I'm sure there's a way to do it programatically as well.
Is this what you're asking?
December 11th, 2002, 12:50 PM
Yes, I know that you can set it from within the Access GUI, but I'm trying to accomplish it pragmatically. I have done several searches on Google and different forums and I cannot find any data types for Boolean.
I did find this website which seems to give an example but I still get an unfriendly error message.
CREATE TABLE RentalUnits (
Occupied Boolean DEFAULT F,
PaymentDue Date DEFAULT CURRENT DATE
December 11th, 2002, 12:55 PM
If you're not using the GUI, then why does it matter if the field is Yes/No, True/False or 1/0? That setting is for display purposes like the formatting of a date field. Internally, they're all stored the same way.
December 11th, 2002, 01:03 PM
I'm sending data to this colleague who asked for me to replicate and fill some tables that he sent me. I would think that an integer data type would be fine, but I cannot contact him at the moment. Therefore, I thought that I would see if I could find a way to store it as a Boolean.
December 11th, 2002, 01:08 PM
What I was trying to say in my previous post was if you are using a boolean data type then storing a 0, NO or FALSE in the field is all equal to the same thing. Setting the YES/NO field is not important to how the data is stored, it just affects the way the data is displayed visually.
In other words, it doesn't matter how you store or replicate the boolean values. The person you are sending them to can view them in any format he likes.
December 11th, 2002, 01:23 PM
Then I'll just run with it as an integer type.