Results 1 to 6 of 6
  1. #1
    4 Star Lounger
    Join Date
    May 2003
    Location
    Manchester, Gtr Manchester, England
    Posts
    552
    Thanks
    0
    Thanked 0 Times in 0 Posts

    restricting form input (2000)

    Hi, I have an option group on a form, depending on which is selected a series text boxes appear to enable input. I want to be able to restrict so that input can only be put in one of these boxes.

    Thanks Darren.

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

    Re: restricting form input (2000)

    Instead of displaying multiple text boxes of which only one can be filled in, I would display one text box together with an option group or combo box to specify what the contents signify.

    If that won't work for you, please explain in more detail what you want to accomplish.

  3. #3
    4 Star Lounger
    Join Date
    May 2003
    Location
    Manchester, Gtr Manchester, England
    Posts
    552
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: restricting form input (2000)

    Thanks Hans, there are different types of customer , this is where the option group comes in and depending on which one is selected a drop down appears for some types a text box for others. The problem I am having is that users look for a given customer name in the drop down, say 'Emma Harris', realise Emma Harris is not in the drop down then move to a free text and type in Emma Harris, unfortunatley when the combo was activated, the first Emma in there is remaining, so when a call is logged in such an instance there are two callers showing, one from the typed text and one in the drop down. I want to prevent this from happening.

    Regards Darren.

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

    Re: restricting form input (2000)

    I still don't understand why you would want to have both a combo box and a text box for entering a customer.

    If the Limit To List property of the combo box is set to No, the user can select an existing name from the dropdown list of the combo box, but also type another name into the text box part of the combo box.

    If the Limit To List property of the combo box is set to Yes, the On Not In List event will occur if the user types a name that is not in the dropdown list; you can write an event procedure for this event to decide if the name should be added to the list. If you search for NotInList in this forum, you'll find several examples of how to handle this.

    If you want to keep the separate combo box and text box, you can do something like this:

    Private Sub cbxCustomer_AfterUpdate()
    If Not IsNull(Me.cbxCustomer) Then
    Me.txtCustomer = Null
    End If
    End Sub

    Private Sub txtCustomer_AfterUpdate()
    If Not IsNull(Me.txtCustomer) Then
    Me.cbxCustomer = Null
    End If
    End Sub

    where cbxCustomer is the name of the combo box and txtCustomer is the name of the text box.

  5. #5
    4 Star Lounger
    Join Date
    May 2003
    Location
    Manchester, Gtr Manchester, England
    Posts
    552
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: restricting form input (2000)

    Thanks Hans, spot on.

    Darren.

  6. #6
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: restricting form input (2000)

    If I understand you correctly, then I have another suggestion.

    I sometimes manipulate the visible property of some other controls in the after-update event of an otpion group, so that only the relevant control is visible at any time. Also, when a control is hidden it is also set to null to remove any unneeded data.

    I attach a demo.
    Attached Files Attached Files
    Regards
    John



Posting Permissions

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