1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2004
    Dunedin, FL
    Rep Power

    SQL Select stmt in MS Access

    Hello, New to SQL / Access interface so please bear with me...

    I have a small (not normalized) table which has two important fields.

    Table: tblTest
    Field1: Company
    Field2: Location

    I am trying to allow a user to choose from previously entered data and avoid retyping. ie when a new Company is entered I want them to be able to choose from a combo box filled with previously entered Companies. I used

    SELECT DISTINCT Company FROM tblTest

    Worked great....Now i wish to populate the Location field combo box with ONLY valid locations associated with that company. Started with:

    SELECT DISTINCT Location FROM tblTest WHERE [Company] =

    and that is where I am stuck....
    Question is, how do i reference the previously selected cell?

  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jan 2003
    No es importante
    Rep Power
    If you are using combo boxes you would want the selection from the first combo box to populate the second/dependent combo box. For example: I have a combo box called manufacturers and a combo box called models. When I select a manufacturer that will trigger an event passing the manufacturerID back to the database and issue the following query:
    select distinc carModels
    from models
    where manufacturerID = [passed_value]
    This will in turn populate the second combo box.
    El éxito consiste en una serie de pequeñas victorias día a día

    MySQL, MS SQL, MS ACCESS, Oracle Database Manager - http://victorpendleton.net/products/psdviewer.html

IMN logo majestic logo threadwatch logo seochat tools logo