Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2006

    Unanswered: Listbox and Combo box Issue

    Currently, I am using MS Acess for my development. I have two toolboxes (Combo box and listbox). What I want to achieve is to allow the user to select the data from the combo box and list the selected data that corresponds to what have been selected in the combo box. Ex: Inside the combox I have three data (studentid, name, courses). When the user click on studentid, the courses that he enrolled in will be listed in the listbox, which meant that the corresponding values from the tables databases will be displayed. I am certain that VB Acess can achieved but nt sure as to how to program that. It will be very much appreciated if someone could provide some code snippets or is there a possibility to achieve that using query. Thank alot!

  2. #2
    Join Date
    May 2005
    Nevada, USA
    Provided Answers: 6
    Search here on "cascading" combo boxes, which is where the choices available in the second combo depend on the selection made in the first. Using a listbox instead of a combobox for the second one won't change the technique.

  3. #3
    Join Date
    Jul 2006
    for quick refrence this is the code i used in my cascading boxes

    on the onchange event of the first combo box:
    onchange event handle:
    combobox2.visible = true 'show combo2
    If combobox1.text = "student ID" then
    combobox2.rowsource = "SELECT [studentid] FROM [tblpeople]"
    elseif combox1.text = "Student Name" then
    combobox2.rowsource = "SELECT [name] FROM [tblpeople]"
    elseif combox1.text = "Student Courses" then
    combobox2.rowsource = "SELECT [courses] FROM [tblpeople]"
    msgbox("Please select a value") 
    combobox1.getfocus 'sets focus to combo1
    combobox2.visible = false 'makes combo2 invisi
    onload event handle:
    combobox2.visible = false

Posting Permissions

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