Results 1 to 2 of 2
  1. #1
    5 Star Lounger
    Join Date
    Jan 2004
    Location
    Norfolk, England
    Posts
    744
    Thanks
    0
    Thanked 0 Times in 0 Posts

    User to fill in all fields. (2000)

    I was then about to write an amount of code that would prevent the user from exiting a form and not entering certain data in all the available fields.
    My approach was going to be:

    If IsNull(Me.Date) Then
    MsgBox "Please enter a valid date", vbInformationOnly,"Error!"
    Me.Date.Set Focus
    Exit Sub

    And so on for each field on the exit control of the form. What I'd like to know, is there a quick way to code this to include all fields available on the form as opposed to referring to the name of each field? Presumably with a generic message of "There is data missing, please amend!", I guess that the SetFocus command will not be used.

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

    Re: User to fill in all fields. (2000)

    You can do this at the table level, if you wish. Open the table that contains the data in design view.

    One possibility is to set the Validation Rule property for each field to Is Not Null, and the Validation Text to a suitable warning.

    Another possibility is to set the Required property to Yes; if the field is a text field, also set the Allow Zero Length property to No.

Posting Permissions

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