Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    Join Date
    Apr 2007
    Posts
    81

    Unanswered: create 4 Combo Boxes,

    Hi Everyone

    I want to create 4 Combo Boxes,
    First for Grade Classes
    Second for Subject
    Third for Topics
    forth for Exam No.

    when I select first Grade Class I want show all subject for First Grade in Second combo boxe etc.

    thanks

  2. #2
    Join Date
    Oct 2004
    Location
    Melbourne, Australia
    Posts
    201
    First create your combo boxes, but leave the RowSource blank for the moment. Then, set up the RowSource for the first one in the usual way by clicking on the box with three dots in it and creating a query to give you the list of Grade Classes. Then, for the second box, you put some VBA code in the Click Event which will read something like:

    strSQL= "SELECT <various fields from Subject> where GradeClassID = '" & _
    Forms!MyForm!cmbGradeClass & "'"
    Forms!MyForm!cmbSubject.RowSource = strSQL
    Forms!MyForm!cmbSubject.Requery

    If you do not know how to find the click event, right-click on the combo box and select Properties.

    The code above assumes a string ID (note the single quotes inside the double quotes). Omit the single quotes if the ID is numeric.

    Repeat for each of the combo boxes, each one referencing the one higher up the tree.

    It is also good to set each Rowsource to a blank string when closing the form, to avoid some annoying little parameter prompts as discussed in a recent thread.

  3. #3
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    The concept is called cascading combo boxes. I have a little sample here:

    http://www.baldyweb.com/CascadingCombo.htm
    Paul

  4. #4
    Join Date
    Apr 2007
    Posts
    81
    Hi Jim Wright and pbaldy
    Thank you so much

    I try to accomplish third and forth Combo Boxes For the topic and exam no but I can’t please I need your help

    thanks

  5. #5
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    Which method did you choose? What have you got so far? What happens/doesn't happen? Do you get an error? In other words, simply saying you need help doesn't give us much to go on.
    Paul

  6. #6
    Join Date
    Apr 2007
    Posts
    81
    Hi

    I use First One wich has cboState1 in your riply as the sample.

    thanks

  7. #7
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    The point of all the questions is to find out what you're doing so we can figure out what you're doing wrong. Post the SQL of your queries. Post your code. Post a sample db with your failed effort. Don't just say it doesn't work.
    Paul

  8. #8
    Join Date
    Apr 2007
    Posts
    81
    Hi
    I used MS ACCESS 2007

    there is attach to check it

    thanks
    Attached Files Attached Files

  9. #9
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    why would we want to check it?
    what problems if any are you experiencing?
    what is not working as it should be?

    BTW developing in A2007 rules out many of the contributors here as not every one has A2007
    I'd rather be riding on the Tiger 800 or the Norton

  10. #10
    Join Date
    Apr 2007
    Posts
    81
    Hi

    I want to active combo boxes for TOPICS and EXAM No.,

    thanks

  11. #11
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    What exactly are you having trouble with, as I see no attempt at making it work? The second works, referring to the first. The third and fourth would be conceptually the same. The third would refer to the first and second, and the fourth would refer to the first three.
    Paul

  12. #12
    Join Date
    Apr 2007
    Posts
    81
    Hi

    I tried many time but no avail please I need your help.

    this attach you will see my attempt.

    thanks
    Attached Files Attached Files

  13. #13
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    The rowsource of the third is incorrect. Try

    SELECT ComboBoxTable.Topic
    FROM ComboBoxTable
    WHERE (((ComboBoxTable.grad)=[Forms]![Form1]![ComboGrade]) AND ((ComboBoxTable.subjec)=[Forms]![Form1]![ComboSubject]));

    You also need to requery it in the after update event of the second.
    Paul

  14. #14
    Join Date
    Apr 2007
    Posts
    81
    Hi

    I did as your advice, and I made requery after update event of the second.
    but the third comboBox work only one time and when I need to change topic need to close and open the form again,

    thanks

  15. #15
    Join Date
    Apr 2007
    Posts
    81
    Hi

    Please check ComboBox No. 3 "ComboTopic"

    When select grade and subject then topic that is ok but next time for topic not ok.

    Thanks
    Attached Files Attached Files

Posting Permissions

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