Results 1 to 5 of 5
  1. #1
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Warrington, Cheshire, England
    Posts
    712
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Resetting combo/list boxes (2003)

    Is there a way of returning a combo/list box on a form to a 'null' value? I'm thinking of when a user types something into the field and then decides that they don't want to use that field. I can't find a way of returning the combo/list box to the state that it was initially when the form was loaded.
    Thanks
    Silverback
    Silverback

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

    Re: Resetting combo/list boxes (2003)

    You can simply set its value to Null:

    Me.ComboBox1 = Null

  3. #3
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Warrington, Cheshire, England
    Posts
    712
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Resetting combo/list boxes (2003)

    Hans
    Sorry - didn't make myself clear. I want the user to be able to 'select a null option' to produce the effect of resetting the box to its initial state.
    It's like when I visit a webpage, if there are drop down boxes they are blank to start with. If I select a value, and then change my mind, I can reselect this 'blank' option and it's as if I'd not touched the box at all. (Sometimes there is text in the drop down box something like this - (Please Select) - and teh user can reselect that after selecting another value which produces the effect that the drop down has not been touched.)
    In Access, does it require a null value at the beginning of the combobox list and, if so, how is it produced when the contents of the drop down are being produced by a query?
    Sorry for not being clear in the original posting.
    Thanks
    Silverback
    Silverback

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

    Re: Resetting combo/list boxes (2003)

    Let's say that the row source of your combo box looks like this:

    SELECT tblEmployees.pkeyEmployeeID, tblEmployees.strLastName FROM tblEmployees

    Change it to something like this:

    SELECT tblEmployees.pkeyEmployeeID, tblEmployees.strLastName
    FROM tblEmployees
    UNION
    SELECT Null, Null FROM tblEmployees WHERE pkeyEmployeeID=1

    This will add a blank row to the list. The SQL will have to be modified for your situation, of course.

  5. #5
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Warrington, Cheshire, England
    Posts
    712
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Resetting combo/list boxes (2003)

    Thanks for this, Hans. More new knowledge - neither my wife nor I had ever heard of a union query.
    More for the experience databank!
    Thanks
    Silverback
    Silverback

Posting Permissions

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