• alerting re required fields (Access 2000)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » alerting re required fields (Access 2000)

    Author
    Topic
    #367071

    I have several fields which are required – but my form does not shout at you until you try to go on to the next record. I would like to be able to alert people as soon as they leave the text box that they should have put something in and not let them proceed until they have!

    I have tried to think of some suitable validation – but am not having much luck.

    Thanks

    Viewing 1 reply thread
    Author
    Replies
    • #571414

      The first thing that comes to mind (not necessarily the best) … On the OnExit event of each of these textboxes, you could check for IsNull, display a MsgBox stating the field is required, and return the cursor to the textbox.

      Alternately, you could write it more globally and call it from the appropriate textboxes.

      If you need assistance writing the code, post again.
      HTH

      • #571419

        a bit of code would be much appreciated. As I am not sure how the syntax would go.

        Thanks for your assistance

        • #571420

          In the On exit of the textbox:

          Private Sub txtField_Exit(Cancel As Integer)
          If IsNull(Me!txtField) Then
             MsgBox "You have to enter something in this field"
             Cancel = True
          End If
          End Sub
          
    • #571599

      One warning about using the OnExit code that the others mentioned. That’ll work if you’re tabbing from one field to the next, but the OnExit code won’t stop you from skipping fields entirely using the mouse.

    Viewing 1 reply thread
    Reply To: alerting re required fields (Access 2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: