Results 1 to 4 of 4
  1. #1
    Lounger
    Join Date
    Dec 2002
    Location
    Rochdale, Gtr Manchester, England
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Force an entry in a field - how ? (2000/2002)

    I have a form with a field "Schedulers Name". I want that to be filled in and for it not to be left empty. I can set the validation property to be "Is not Null" but that doesn;t stop a user from tabbing over it. Is there anything I can do to force them to enter something here ?

    Alan

  2. #2
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Force an entry in a field - how ? (2000/2002)

    Hi Alan

    One way would be to put an save Button on form with something like the following:

    Private Sub Save_Record_Click()
    On Error GoTo Err_Save_Record_Click

    If IsNull(lngClassID) Then
    MsgBox "You must enter a valid Class Code!"
    Me!lngClassID.SetFocus
    Exit Sub
    End If

    End Sub

    HTH

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

    Re: Force an entry in a field - how ? (2000/2002)

    If Schedulers Name is a field in the table underlying the form, set the Required property of the field to Yes in the table.

    If Schedulers Name is an unbound text box, you'll have to put a test in the BeforeUpdate event of the form:

    Private Sub Form_BeforeUpdate(Cancel As Integer)
    If IsNull([Schedulers Name]) Then
    MsgBox "You must enter a name!", vbInformation
    [Schedulers Name].SetFocus
    Cancel = True
    End If
    End Sub

  4. #4
    Lounger
    Join Date
    Dec 2002
    Location
    Rochdale, Gtr Manchester, England
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Force an entry in a field - how ? (2000/2002)

    Thanks - I'll try that.

    Alan

Posting Permissions

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