Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2004
    Posts
    24

    Unanswered: Changing the values on a Lookup list

    I need to setup two lookup list on a form. When a user chooses a value on the first list, the second list will show some related choices. These choices need to be different on the second table, depending on the values chosen on the first table?


    How do I go about setting this up?

  2. #2
    Join Date
    Feb 2004
    Location
    UK
    Posts
    246
    Hi,
    You need to do a cascade if you look in http://www.fontstuff.com/access/acctut10.htm there is an example of how to achieve this.

    HTH
    John

  3. #3
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Ok, first question is what sort of controls and recordsets are we talking about here? I'm guessing you're using two listboxes? Are you using two seperate tables or recordsets for the listboxes?

    If for instance you have the following two tables:

    t1:
    t1_id PK
    title

    t2:
    t2_id PK
    t1_id FK
    option

    (assume there are multiple options for each title)

    You could assign t1 as the record source for the first list box (listbox1), then in the AfterUpdate event, you could set the recordsource for t2 accordingly:

    listbox2.RowSource = "SELECT option FROM t2 WHERE t1_id = " & listbox1.Value

    If you're using recordsets, you could do roughly the same thing using the filter property of the recordset. eg:

    rsT2.filter = ("t1_id = " & listbox1.Value)

  4. #4
    Join Date
    Mar 2004
    Posts
    24

    Thumbs up

    Thanks for the quick reply Sticker and Teddy. You guys are real life savers.

Posting Permissions

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