Results 1 to 6 of 6
  1. #1
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    2,073

    ALTER TABLE does not set field "format"

    The following statement executes okay, but the "field format" does not get set to yes/no even though the table design view shows the field data type as in fact being yes/no. With that, when the table is viewed, the field displays as zero (0) as opposed to a check-box. My intent is to create a check-box with the initial value of false.



    What am I missing here?

    strDDL = "ALTER TABLE Families ADD Column FamilyDirSC YESNO False"

    Thanks,
    Bill

  2. #2
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Where does this table reside?
    Is it a native Access table, or a SQL table?
    If an Access table, why are you adding it like that with code as opposed to editing the data directly in Access?

    In any event, you shouldn't really about wanting to display it as a check box in the Table view, because people should not be accessing/viewing/editing your tables directly. You usually want everything to be Form driven. On the Form, you can add a check box field, and use this field as the Control Source.

  3. #3
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    2,073
    The back-end mdb's are application version sensitive. If I release a new version of the app and the new version includes an added field to the DB, there's initialization code that senses the version of the DB and updates table defs accordingly.

    I think my question arises more from what I'm used to seeing as a developer, namely when in Table view I see a check-box rather than "Yes" or "No" displayed. And yes, when I use the new field value as the control source of a check-box on a form, it in fact behaves as expected.

  4. #4
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Yes, in linked databases (where the tables are elsewhere and linked in), it seems that you have limited options in the format of the fields. But it really shouldn't matter, as we discussed. What you are seeing is actually how Access stores the data in the tables. The formatting just changes how it is presented to you, but has no impact on the actual stored value.

  5. #5
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    2,073
    The initialization code has been around forever and has done version updates in the field for several years. I would have been willing to bet a lunch that in the past when linked tables were updated via that code that YES/NO fields were formatted as check-boxes when viewed in Table view..........oh well, no harm no foul. Thanks for your thoughts.

  6. #6
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    There may be a way, but I haven't found it yet!
    Then again, I never spent much time on it as I was never overly concerned about it.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Format([TableName.FieldName],"s0")
    By Remster in forum Queries
    Replies: 3
    Last Post: 10-05-2011, 03:26 AM
  2. Replies: 16
    Last Post: 07-22-2011, 09:23 AM
  3. What format is "print to file" ?
    By degras in forum Reports
    Replies: 2
    Last Post: 03-24-2011, 03:47 AM
  4. "Unrecognized Database Format" After Using 2010
    By ajetrumpet in forum Code Repository
    Replies: 4
    Last Post: 03-21-2011, 11:59 PM
  5. Field "F1" does not exist in table (Tablename)
    By HelenP in forum Import/Export Data
    Replies: 3
    Last Post: 11-26-2010, 09:13 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums