• Text/combo Box to show Null (2000)

    Author
    Topic
    #395065

    Hi, I have a combination of text boxes (unbound) and a bound combo box which are used to search for records. These boxes are part of an overall form however after each search and then subsequent adding of a new record, the search fields are still populated with the details from the earlier search. How can I make these default to null each time my form is ready to accept a new record? I have tried code on one or two events but this clears the boxes on finding the record which I don’t need.

    Thank you.

    Viewing 0 reply threads
    Author
    Replies
    • #729301

      Can you describe what you do need? At what point do you want to clear the various textboxes/comboboxes? You could certainly do it on the AfterInsert event of the form, but it isn’t clear what you really want.

      • #729381

        Thanks Charlotte, there are 3 boxes where data may be entered in one, twoo or all three to search for records in the database. These boxes are on the form that users use to view, add and modify records. This works fine in finding the record, however when a user clicks add to start entering a new record, the search data entered in the thre boxes for the earlier search remain. I would like them to be clear.

        Thanks Darren.

        Thanks Darren.

        • #729554

          Try the On Current event of the form, and test whether you are on a new record:

          Private Sub Form_Current()
          If Me.NewRecord Then
          Me.TextBox1= “”
          Me.TextBox2= “”
          Me.TextBox3= “”
          End If
          End Sub

          Substitute the names of your text boxes.

          • #729847

            Thanks Hans.

            • #730720

              Here’s a question for all of you.

              I know a combo box can be used to jump to a particular record, but then if there is any other way of moving to a different record, say by leaving the standard navigtion buttons on the form, the combo will display last selection regardless, which could be a bit confusing.

              What are you views on using a combo box show a particular record – if used should it be the only navigation method on the form? or should it just be cleared if the user then moves records by any other means.

            • #730723

              You could clear the combo box (set it to Null) after jumping to a record.

              Or, if you would really like to keep the combo box synchronized with the current record in the form, take a look at the demo database I attached to post 300904. It would have to be adapted a bit, because the demo has a list box and a subform, but the basic idea would be the same.

            • #730724

              You could clear the combo box (set it to Null) after jumping to a record.

              Or, if you would really like to keep the combo box synchronized with the current record in the form, take a look at the demo database I attached to post 300904. It would have to be adapted a bit, because the demo has a list box and a subform, but the basic idea would be the same.

            • #730721

              Here’s a question for all of you.

              I know a combo box can be used to jump to a particular record, but then if there is any other way of moving to a different record, say by leaving the standard navigtion buttons on the form, the combo will display last selection regardless, which could be a bit confusing.

              What are you views on using a combo box show a particular record – if used should it be the only navigation method on the form? or should it just be cleared if the user then moves records by any other means.

          • #729848

            Thanks Hans.

        • #729555

          Try the On Current event of the form, and test whether you are on a new record:

          Private Sub Form_Current()
          If Me.NewRecord Then
          Me.TextBox1= “”
          Me.TextBox2= “”
          Me.TextBox3= “”
          End If
          End Sub

          Substitute the names of your text boxes.

      • #729382

        Thanks Charlotte, there are 3 boxes where data may be entered in one, twoo or all three to search for records in the database. These boxes are on the form that users use to view, add and modify records. This works fine in finding the record, however when a user clicks add to start entering a new record, the search data entered in the thre boxes for the earlier search remain. I would like them to be clear.

        Thanks Darren.

        Thanks Darren.

    Viewing 0 reply threads
    Reply To: Text/combo Box to show Null (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: