Results 1 to 5 of 5
  1. #1
    millerdav99 is offline Novice
    Windows XP Access 2003
    Join Date
    Mar 2011
    Posts
    10

    Combo Box Query.

    Please bear with me as I am new to Access and trying to learn this in two minute increments between service calls for a work assignment.



    I have a form with two list boxes. I would like them to cascade. I have the data for both boxes in one table. The fields of the table are populating the first list box. In the second box I would like the information in the columns of the corresponding fields to show up in the second list box.

    I've watched the data pig tutorials which have the data set up a little differently in the table. Maybe my set up is not optimal. Looking for some opinions on that, and possibly how to set up the query on the second combo box to select the column of data based on the field name that is selected in the first list box.

    I have some VB code attached to the AfterUpdate event of list box one that works when I am on the first record of the forms table. If i navigate to a different record it no longer works.

    List84 is the first list box with the fields
    lstIssues is the second list box
    tblQuestionsProblems is the table with the fields and corresponding data in columns
    frmCallRecordEntry is the form this is running on

    Code:
    Private Sub List84_AfterUpdate()
    Dim strSQL As String
        strSQL = "SELECT [tblQuestionsProblems].[" & Forms![frmCallRecordEntry]!List84
        strSQL = strSQL & "] FROM tblQuestionsProblems;"
        Forms![frmCallRecordEntry]!LstIssues.RowSourceType = "Table/Query"
        Forms![frmCallRecordEntry]!LstIssues.RowSource = strSQL

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,847
    The title of your post is COMBO BOX, but your post is about LISTBOXes???

    Go to datapig and watch the video on 2 comboboxes.
    http://www.datapigtechnologies.com/f...combobox2.html


    There is a similar question/answer here that may help
    http://en.allexperts.com/q/Using-MS-...list-boxes.htm

  3. #3
    millerdav99 is offline Novice
    Windows XP Access 2003
    Join Date
    Mar 2011
    Posts
    10
    Does anyone have an idea why my code would work fine until I navigate to another record? I'm going to do some troubleshooting to see if my code actually runs when not on record one, but I do not really know if I have my code in the right place or perhaps my event is not properly referenced in the listbox properties?

    Do the generic navigation buttons do something weird?

  4. #4
    millerdav99 is offline Novice
    Windows XP Access 2003
    Join Date
    Mar 2011
    Posts
    10
    I fixed it. for some reason the bound column on the 2 list box was 2, probably from messing around with it in the first place. it is working now!

  5. #5
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,847
    Glad you got it solved.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Using combo box for query value
    By yawalias in forum Queries
    Replies: 8
    Last Post: 06-04-2014, 12:15 PM
  2. Query from a Combo Box Selection?
    By bkvisler in forum Queries
    Replies: 3
    Last Post: 09-04-2010, 06:11 PM
  3. Combo box and filter query
    By thart21 in forum Forms
    Replies: 7
    Last Post: 04-06-2010, 11:37 AM
  4. How to Query a Multi Value Combo Box
    By Viperpurple in forum Queries
    Replies: 0
    Last Post: 03-22-2010, 07:33 AM
  5. Combo box query
    By P5C768 in forum Queries
    Replies: 7
    Last Post: 09-18-2009, 05:51 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums