Results 1 to 4 of 4
  1. #1
    Draco is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Dec 2012
    Posts
    2

    How to Change a Combo Box's Row Source Based on Selection Made in Another Combo Box

    Ok, so, what I know of Access I've pretty much taught myself but VBA is a beast of thing to learn. The problem is, not knowing VBA in and out really limits what you can accomplish in Access.



    The issue I have is I have a combo box bound to a table (Conrtol Source - Main Table, which of course is the Record Source for the entire form) and bound to another table (Row Source - lookupmedium). I also have another combo box bound to the same table as the other one (Control Source - Main Table) but I want to change the Row Source based on the selection made in the first combo box mentioned.

    For example:

    When the user selects TV from the first combo box I need the second combo box to list only the options that are TV stations

    e.g. user selects TV from combo box one and the second combo box uses the the subLookupTV table as it's Row Source so that only TV stations are shown.

    or the user selects Radio from combo box one and the second combo box uses the subLookupRadio table as it's Row Source so that only Radio Stations are shown.

    I already have the tables built that will only contain radio stations or only contain TV stations and so forth. Just need the piece of code to link them all in that way. I assumed it might be an "IF-THEN" code or a Select Case code but it's hard to say.

    Thanks!

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,540
    IMHO it might be better to have one table for ALL the radio and TV stations with a field that identifies each record as one or the other.
    Your second combo box could then be based on this table with criteria in the identifying field that references the first combo box.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    Draco is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Dec 2012
    Posts
    2
    So what your saying is to combine my seperate tables into one table and have a second collumn in that table identifying the media type (i.e. TV, Radio, etc) for each station and then have the row source for combo box 2 be filtered based on the results of combo box 1?

    How would that work?

    I'm guessing I would have to create a query based on the combined table, for each media type that uses the results of the selection in combo box 1 as a filter. The results of which would become the row source for combo box 2?

    How would I go about coding that?

    Or am I way off?

  4. #4
    alansidman's Avatar
    alansidman is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,529
    There is a good example of what Bob is suggesting in this thread

    http://www.access-programmers.co.uk/...d.php?t=223980

    Alan

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

Similar Threads

  1. Replies: 1
    Last Post: 10-30-2012, 10:29 AM
  2. Replies: 1
    Last Post: 07-11-2012, 08:36 AM
  3. Replies: 33
    Last Post: 01-13-2012, 07:44 AM
  4. Replies: 1
    Last Post: 10-19-2009, 02:37 AM
  5. Replies: 1
    Last Post: 08-26-2009, 10:45 AM

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