Results 1 to 12 of 12

Thread: Clear combobox

  1. #1
    Join Date
    Aug 2004
    Location
    NY
    Posts
    113

    Unanswered: Clear combobox

    Hi, I this I am a newbie and I know this is a simple question but I think I am doing something wrong.

    I have a form that has an unbound combobox in a subform. The combobox has a simple list from a datasource in a qry. When I go through the change records through in the main from, how do I get it to clear the combobox in the subform. I don't want to delete the choices in the combobox. When I select an item and go to a different record that item is still there. How can I clear the combo.

    I think it has to do with a
    Combobox1 ="" (which event do I insert, I tried the one I think it would, it doesnt')

  2. #2
    Join Date
    Oct 2004
    Posts
    5

    Combobox

    Refresh or requiry won't do it ?

  3. #3
    Join Date
    Aug 2004
    Location
    NY
    Posts
    113
    I tried this code that I obtained form searching dbforums. I inserted this on the mainfrom's event but it still doesn't work. The on_curernt event I have it calling a macro, I don't know if I will be able to put it in there.


    Forms!sfrform!Combo16.SetFocus
    Forms!sfrform!Combo16 = ""


    I also tried this below but with no luck
    Form_sfrform.Refresh

  4. #4
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1

    Post

    Try
    Forms!mainForm!SubForm!comboBox.RowSource=""

  5. #5
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    choose wisely!

    to "delete the choices":
    combo16.rowsource = ""
    ...but you say you don't want to do this

    to have no current choice:
    combo16 = null

    izy
    currently using SS 2008R2

  6. #6
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    IsyRider:
    the combo box is not directly on the main form, it is on a subform.
    so he can not use combo16.rowsource="" to delete its content..

  7. #7
    Join Date
    Nov 2003
    Location
    Sussex, England
    Posts
    404

    Null

    Whatever the even tis:

    combo16=null

    I've jsut tried this. The list of choices is still available but nothing is selected.

  8. #8
    Join Date
    Jul 2004
    Location
    Inverurie
    Posts
    628
    when creating the combo box, you are allowed to view the fields that will be used in the wizard prior to it being functional (in the way you want it.)

    What you could do is to add a blank row at this point, and then set the combo box to that when you perform the action that you want.

    Or you could just set the fore colour to white, and then set the combo box to change it back to black on the AfterUpdate event.
    Last edited by cruickshanks; 10-13-04 at 07:01.

  9. #9
    Join Date
    Aug 2004
    Location
    NY
    Posts
    113
    I don't want to delete the record source.
    There is a masterform that has a subform1 and subform1 has subform1a. the combobox is in subform1. When I select the option from the combobox, it fills it in subform1a. When I go to the next record in the masterform, I still see my selection in the combobox. Subform1a is not filled, which is good. However it is a nuisance that the combox has something in there. What I want is when I change records in the masterform the combobox is null but there are records in there if I click the dropdown.

    If I close and reopen the form does not have a default value.

    I thougth it would have been something like combo16=null

  10. #10
    Join Date
    Apr 2004
    Location
    Kingsland, Georgia
    Posts
    231
    It's possible that I'm misunderstanding the question (happens often), but would
    Code:
       subForm1.Form.combo16.Value = Null
    do what you want it to? this is assumming you launch it when you change a record in the masterform. if you're using the built in record selectors, i do't know how you'd do it. but if you have your own navigation buttons, this should work in the _Click() event of your button. hope it helps. sorry if it doesn't.

  11. #11
    Join Date
    Jul 2004
    Location
    Inverurie
    Posts
    628
    try using the above on the after update event on the subform. it should work that way.

  12. #12
    Join Date
    Aug 2004
    Location
    NY
    Posts
    113
    Thank you jmahaffie and cruickshanks, it worked :-)

Posting Permissions

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