Results 1 to 9 of 9
  1. #1
    Star Lounger
    Join Date
    Oct 2006
    Location
    Albany, New York, USA
    Posts
    72
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Required fields (2003)

    Hi Folks,
    Yesterday, while teaching an Access 2003 level 1 course, one student asked if she deleted information from a required field in a form and then closed it, if the information would be gone from the table. I told her that she would not be able to close the form or access another record until there was information in the required field. I told her to go ahead and try it. To my astonishment, she did exactly that. When she closed the form and opened the table, the required field was empty. I immediately checked the required property and it was set to yes. I canít make this happen on my PC. Has anyone else ever experienced this?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Required fields (2003)

    If you have a text field with Required set to Yes and with Allow Zero Length also set to Yes, you can clear the field - it will contain an empty string "". Since this is different from a Null value, you don't get an error message. If you want to avoid this situation, set the Allow Zero Length property of the field to No.

  3. #3
    Star Lounger
    Join Date
    Oct 2006
    Location
    Albany, New York, USA
    Posts
    72
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Required fields (2003)

    Thanks Hans, didn't notice that. However, when I change Allow zero length string back to no, I can still open and close both the table and form with no info in the required field (it's a soc sec number field). This shouldn't be allowed to happen should it, the field even has an input mask, I would think one or the other properties should take care of this, no?

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Required fields (2003)

    Did you change anything in the record? If you visit a record then leave it without editing it, Access doesn't perform any checks.

  5. #5
    Star Lounger
    Join Date
    Oct 2006
    Location
    Albany, New York, USA
    Posts
    72
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Required fields (2003)

    Hi Hans,
    Wow, kind of a big hole isn't it.

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Required fields (2003)

    I don't think it's a bug. Under normal circumstances it's only necessary to check for required fields etc. when the record has been modified. Performing these checks whenever the user exits a record, even if it hasn't been changed, would be superfluous and have a negative effect on performance - scrolling through the records of a form would slow down significantly.

  7. #7
    Star Lounger
    Join Date
    Oct 2006
    Location
    Albany, New York, USA
    Posts
    72
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Required fields (2003)

    When I duplicate the creation of the practice table that I use in class, the allow zero length property is set to yes by default on all my text fields.
    The help files say that no is the default setting (it always has been in all the classes that I've taught). Iím just wondering what changed and when it changed.
    Does anyone know how I can change the default back to no?

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Required fields (2003)

    The default for Allow Zero Length was No in Access 97, and it has been Yes in Access 2000 and all later versions. There is no way to change this default, you have to change it for each new text field. <img src=/S/crazy.gif border=0 alt=crazy width=15 height=15>

    Allen Browne has written code that will set Allow Zero Length to No for all text fields (except in the Switchboard Items table where this would cause other problems) - see Microsoft Access Flaws - Problem properties (contains other useful info too).

  9. #9
    Star Lounger
    Join Date
    Oct 2006
    Location
    Albany, New York, USA
    Posts
    72
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Required fields (2003)

    Thanks again Hans. You're right as usual. I was fooled by the Access help files.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •