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

    Force Operator To Enter A Value? (a2k (9.0.6926) SP-3 Jet 4.0 SP-8)

    I have a Form (Order Header) and Sub Form (Order Details)

    The first field of Sub Form Section: Detail portion is a one character bound combo box

    If the operator presses the Enter or Tab Key the cursor advances to the next field

    I want to force the operator to enter a value before proceeding

    What Event and what code do I need to to keep the focus on this field until it is filled in?

    Thanks, John

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

    Re: Force Operator To Enter A Value? (a2k (9.0.6926) SP-3 Jet 4.0 SP-8)

    You can use the On Exit event of the combo box, and set its Cancel argument to True if nothing has been entered.

    Private Sub cboSomething_Exit(Cancel As Integer)
    If IsNull(Me.cboSomething) Then
    MsgBox "Please select an item from the list.", vbExclamation
    Cancel = True
    End If
    End Sub

    with the appropriate name substituted, of course.

  3. #3
    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 Operator To Enter A Value? (a2k (9.0.6926) SP-3 Jet 4.0 SP-8)

    The code you suggested is firing many times "Please select an item from the list." when the Order Entry form is opened

    The Form (Order Header) opens another dialog form to get batch date and batch number information

    Then the Form (Order Header), with empty record set, populates the Sub Form (Order Details) with the last Order processed in previous session

    Hope this makes sense.

    Is there another way to do this?

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

    Re: Force Operator To Enter A Value? (a2k (9.0.6926) SP-3 Jet 4.0 SP-8)

    Instead of using code, you could set the Required property to Yes for the field the combo box is bound to. The user can tab out of the combo box, but can't leave the record if the combo box is blank.

  5. #5
    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 Operator To Enter A Value? (a2k (9.0.6926) SP-3 Jet 4.0 SP-8)

    My problem is this 1st combo restricts the population on a 2nd combo which is the next field.

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

    Re: Force Operator To Enter A Value? (a2k (9.0.6926) SP-3 Jet 4.0 SP-8)

    It's becoming too complicated. Educate your users.

Posting Permissions

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