Results 1 to 5 of 5
  1. #1
    Join Date
    Nov 2007
    Posts
    35

    Unanswered: Connecting two comboboxes after update

    Hi there,
    Im trying to learn Access and may need some help please.

    These are my tables:
    LocationsTable{LocationID, Location}
    PersonsTable{PersonID, Name, LocationID}

    My form has two comboboxes:
    Persons
    Locations

    What Im trying to achieve
    I would like the second combobox to automatically choose the person's location based on who I actually chose in the first combobox (but still let me choose another location).
    So for example, when I choose Dan from combo1, I would want combo2 to point to Kitchen.

    I tried setting an Event Procedure for the first combobox AfterUpdate, but I cannot figure out how can I derive data from my table and set the combo's value based on it.

    Any help will be appreciated,
    Ronh

  2. #2
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    You were on the right track. Make sure the Person combo source includes the location ID, then in the after update event set the second combo's value to the location ID column of the first.
    Paul

  3. #3
    Join Date
    Nov 2007
    Posts
    35
    I basically understand what I need to do, but code-wise I still cant see how I would refer to a table, or a certain index of a table.

    I do have some basic background in coding, but Im not familiar with vbasic.
    Will be grateful if someone can direct me to a tutorial on the subject.

  4. #4
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    You don't need to refer to the table when you have the data in the combo. Presuming your first combo includes all 3 columns in that order, in the after update event:

    Me.SecondCombo = Me.FirstCombo.Column(2)

    the column property is zero based, so the third column is 2.
    Paul

  5. #5
    Join Date
    Nov 2007
    Posts
    35
    Thank you! this worked just as intended.
    Now I will see if I can find a tutorial for the language and make clearer what every method does.

Posting Permissions

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