Results 1 to 4 of 4

Thread: Can't Clear List In Datacombo!

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2004
    Location
    carmi,IL.
    Posts
    105

    Exclamation Can't Clear List In Datacombo!

    Hello:

    I have a datacombo3 that I can't clear the drop down list until I exit and reload the form.

    Set DataCombo3.DataSource = Nothing
    Set DataCombo3.RowSource = Nothing

    It sill show the list from the last ado connection. Even after setting the Datasource & Rowsource to nothing and rebinding with the below statement.


    This is a Blank DataBase
    '*****************************************
    Dim sql As String
    sql = "Select * from Brand order by brand"

    Adodc3.CommandType = adCmdText
    Adodc3.RecordSource = sql
    Adodc3.Refresh

    Set DataCombo3.DataSource = Adodc3
    Set DataCombo3.RowSource = Adodc3.Recordset

    DataCombo3.BoundColumn = "ID"
    DataCombo3.ListField = "Brand"

    DataCombo3.Text = DataCombo3.Text
    DataCombo3.BoundText = DataCombo3.BoundText 'A trick to help
    David M. Camp

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Can't Clear List In Datacombo!

    Issues like this is just one of the reasons that very few people use bound controls.. for more, see this FAQ article.

    I would recommend using code to connect to the database instead.. it is about the same amount of work for the simple things, and much less for the more complex things. It also avoids issues like this, as well as installation issues.. and more importantly, there are many more people here who can help you with it.

    If you want to give it a try, see the ADO Tutorial link in my signature, and the ADO section of our Database FAQs for further things that can be done.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Oct 2004
    Location
    carmi,IL.
    Posts
    105

    Re: Can't Clear List In Datacombo!

    Just wanted to say Thank You!

    I did what you said and everything is working just fine.
    David M. Camp

  4. #4
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Can't Clear List In Datacombo!

    Good stuff, I'm glad you got it sorted - thanks for letting us know.


    As you have the answer to your question (even tho it was probably more work than you wanted!), could you please do us a little favour, and mark this thread as Resolved?
    (this saves time reading for those of us who like to answer questions, and also helps those who search to find answers)

    You can do this by clicking on "Thread tools" just above the first post in this thread, then "Mark thread resolved".

Posting Permissions

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



Click Here to Expand Forum to Full Width