Results 1 to 4 of 4
  1. #1
    Star Lounger
    Join Date
    May 2004
    Posts
    81
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Search Form (Access 2000)

    Hello everybody,
    I have one more question that I could use some help on. I have a form that has combo boxes on it. These combo boxes supply criteria for a query. The query is run when a command button is pushed. Is there a way to clear all the combo boxes with say a command button so that the form is then "refreshed" and new selections can be made or ommited. Again everybody in the forum has helped me out alot and I would like you all to know that I appreciate it more than words can describe.

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

    Re: Search Form (Access 2000)

    You can clear the combo boxes by setting them to Null.

    So behind the command button put code like:

    me![combooOne]= Null
    me![comboTwo] = Null

    replace comboOne with the name of the first combo box etc
    Regards
    John



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

    Re: Search Form (Access 2000)

    Why not? You can create a command button, let's say cmdClearSelections, with the following On Click code:

    Private Sub cmdClearSelections_Click()
    Me.cmbFirstCombo = Null
    Me.cmbSecondCombo = Null
    Me.cmbThirdCombo = Null
    End Sub

    Substitute the names of the combo boxes, and add or remove lines as needed. If the combo boxes on the form are all used as selection criteria, you could also do this:

    Private Sub cmdClearSelections_Click()
    Dim ctl As Control
    For Each ctl in Me.Controls
    If ctlControlType = acComboBox Then
    ctl.Value = Null
    End If
    Next ctl
    Set ctl = Nothing
    End Sub

  4. #4
    Star Lounger
    Join Date
    May 2004
    Posts
    81
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Search Form (Access 2000)

    Great stuff everyone thanks alot.

Posting Permissions

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