Results 1 to 3 of 3
  1. #1
    Woodie is offline Novice
    Windows XP Access 2007
    Join Date
    Jan 2014
    Posts
    2

    NOVICE? combo box to populate with differnt data depending on data in another feild

    I am a complete novice. Be aware I am not familiar with all of the proper Access jargon, so type slowly so I can follow you. I have been using Access for a while with the meanest of understanding. I am currently trying to set something up that seems pretty easy, but I have no idea how to accomplish it.
    I have a field in my database named: "Subjects". It is a combo box right now. I just click on the drop down and select the proper "subject" for my library books. But I want to add a "sub-category" field that will populate with ONLY the appropriate sub-categories for the subject I have selected. So for example if I select the subject "Non-Fiction" in the "SUBJECTS" field I want the "sub-category" field drop down box to only have the "non-fiction" categories such as "self-help, do-it-yourself, history, politics, homemaking, gardening" etc.

    Is there a simple way to do this that a novice can handle?

    thanks in advance

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    What you're talking about is called 'cascading combo boxes'

    To handle it you will have to have two tables

    tblSubjects

    tblSubjectGroups

    (or something similar)

    tblSubjects should have a primary key (autonumber) and, at the very least, a description of your main subjects (non-fiction, etc)

    your tblSubjectGroups should have it's own PK (autonumber again will work fine) a foreign key to your subjects table and, at the very least, a description of that sub category (self-help, do it yourself, history, etc)

    Then when you catalog your books each book would have a foreign key to your tblsubjects and your tblsubjectgroups

    For your data entry you would have two combo boxes, one based on tblsubjects, one based on tblSubjectGroups, in one of the events of tblsubjects (I prefer the ON EXIT property myself) of the combo box relating to tblsubjects you want to have code like

    Code:
    [subjectgroups_Field_Name].requery
    The most important part to get this to work is that your data source for the combo box holding tblsubjectgroup must have a criteria in the field holding the tblSubjects FK (foreign key) of

    [forms]![formname]![subjects_combo_box_name]

    Where formname is the name of your form
    subjects_combo_box_name is the name of your 'first' combo box

  3. #3
    Woodie is offline Novice
    Windows XP Access 2007
    Join Date
    Jan 2014
    Posts
    2
    Thanks for the quick response. I will work on this and reply

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

Similar Threads

  1. Display table data depending on selected data
    By swavemeisterg in forum Forms
    Replies: 7
    Last Post: 07-30-2013, 03:43 PM
  2. Replies: 6
    Last Post: 05-16-2013, 07:44 PM
  3. Replies: 2
    Last Post: 12-05-2012, 10:17 AM
  4. Replies: 1
    Last Post: 09-21-2012, 03:31 PM
  5. Replies: 6
    Last Post: 04-27-2012, 01:31 PM

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
  •  
Other Forums: Microsoft Office Forums