Filter database to listbox
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: Filter database to listbox

  1. #1
    Join Date
    Jan 2002
    Posts
    195

    Filter database to listbox

    I'm using VS 2010 professional and the basic programming language. I have an access database which is pretty simple. I have 1 table named Cards which have 4 feilds Question, Answer, Topic, and Source. I've got two other table which hold the lookup values for Topic and Source.

    On the Form I've got 2 bound listboxes for Topic and Source. I want to populate a third list box with the Question and Answer based on the records in table cards who's Topic and Source feilds match the selected items in the other 2 listboxes.

  2. #2
    Join Date
    Jan 2006
    Location
    Chicago, IL
    Posts
    14,986

    Re: Filter database to listbox

    You could use the On_Changed() function of each LB. Just modify a .Filter() command whenever one changes. That way you can bind table to the results, and filter out what the user selects
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    Jan 2002
    Posts
    195

    Re: Filter database to listbox

    It's really the code that I need help with.

  4. #4
    Join Date
    Jan 2006
    Location
    Chicago, IL
    Posts
    14,986

    Re: Filter database to listbox

    Take a look at the samples, here
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

Tags for this Thread

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center