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

    Text/combo Box to show Null (2000)

    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.

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Text/combo Box to show Null (2000)

    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.
    Charlotte

  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: Text/combo Box to show Null (2000)

    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.

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

    Re: Text/combo Box to show Null (2000)

    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.

  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: Text/combo Box to show Null (2000)

    Thanks Hans.

  6. #6
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Manchester, Gtr Manchester, England
    Posts
    299
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Text/combo Box to show Null (2000)

    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.

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

    Re: Text/combo Box to show Null (2000)

    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>post 300904</post#>. 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.

Posting Permissions

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