Results 1 to 3 of 3
  1. #1
    mavisyew is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    Aug 2014
    Posts
    34

    Does not prompt error message when the field is null

    Hi All,

    I have a tbl with some fields which is Required = Yes, Validatetion = Is not Null and Validatetion Text = The field is empty, please enter some value.

    There are total around 5 fields with this setting.

    I have created a form for the user to enter the fields.



    When the user save the entry, they will be prompted if they want to save the change but the system did not prompt the field is empty.

    When any fields is empty which is required, and the user select to save the change, the system will not save the changes as the required field is empty.

    My question will be how come there is not error message prompt to the user when the required field is empty.

    Thanks

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Are you using VBA or Macros for data validation?

    I prefer VBA and will test for Null AND an empty string. Depending on the data type of the field/control, I may test for other stuff.

  3. #3
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Quote Originally Posted by mavisyew View Post

    ...When any fields is empty which is required, and the user select to save the change, the system will not save the changes as the required field is empty...
    How, exactly, is the user saving the changes? It's not by using a Command Button to Close the Form, is it? The only scenario that I've heard of, where this occurs is if the Form is closed using

    DoCmd.Close

    It has long been recommended that the code

    DoCmd.RunCommand acCmdSaveRecord

    or

    If Me.Dirty Then Me.Dirty = False

    be inserted before using

    DoCmd.Close

    to close a Form because of a quirk in Access. When DoCmd.Close is used, Access closes the Form regardless of whether or not a PK field has been duplicated, a PK field or other Required Field has been left blank or validation rules have been violated!

    If one of these things occur, Access will simply dump the Record, Close the Form, and not tell the user that the Record has been dumped!

    The code If Me.Dirty Then Me.Dirty = False or DoCmd.RunCommand acCmdSaveRecord forces Access to attempt to Save the Record, and if a violation has occurred, will throw up a warning message, allowing correction to be made before Closing the Form.

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

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

Similar Threads

  1. Within 24 Hours Prompt Message Box
    By tdoolittle in forum Programming
    Replies: 2
    Last Post: 07-31-2014, 12:33 PM
  2. Replies: 7
    Last Post: 09-21-2012, 03:30 PM
  3. How to put a prompt message inside a text box
    By usmcgrunt in forum Forms
    Replies: 3
    Last Post: 11-05-2010, 09:55 AM
  4. Null field message
    By jpkeller55 in forum Access
    Replies: 3
    Last Post: 09-03-2010, 10:45 AM
  5. Replies: 5
    Last Post: 03-04-2010, 05:41 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