#1
  1. Some day I will be a Lambda!
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2002
    Location
    NJ
    Posts
    18
    Rep Power
    0

    Question 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.

    Thanks

    Eric
  2. #2
  3. Big Endian
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    May 2001
    Location
    Fly-over country
    Posts
    1,172
    Rep Power
    29
    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?
  4. #3
  5. Some day I will be a Lambda!
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2002
    Location
    NJ
    Posts
    18
    Rep Power
    0
    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.
    Website

    Code:
    CREATE TABLE RentalUnits (
         UnitId Counter, 
         Address char(30), 
         Occupied Boolean DEFAULT F,
         PaymentDue Date DEFAULT CURRENT DATE
    )
    Eric
  6. #4
  7. Big Endian
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    May 2001
    Location
    Fly-over country
    Posts
    1,172
    Rep Power
    29
    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.
  8. #5
  9. Some day I will be a Lambda!
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2002
    Location
    NJ
    Posts
    18
    Rep Power
    0
    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.
  10. #6
  11. Big Endian
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    May 2001
    Location
    Fly-over country
    Posts
    1,172
    Rep Power
    29
    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.
  12. #7
  13. Some day I will be a Lambda!
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2002
    Location
    NJ
    Posts
    18
    Rep Power
    0
    Thanks.

    Then I'll just run with it as an integer type.

    Eric

IMN logo majestic logo threadwatch logo seochat tools logo