Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2009

    Unanswered: Limiting A Combo Box

    I have a form that has T_Company as the primary form and T_Address as the subform - both pull data from tables with similar names. Within the T_Address table I have a field called AddressName, where I store a short description of the address (e.g. Company HQ or some other short descriptor).

    On the subform I have turned the AddressName field into a combo box, and would like to limit the options in the drop down to just those that correspond to the company / CompanyID which appears in the main form.

    I have attempted to enter the following into the Row Source field in the propertied box of the combo box:

    SELECT T_Address.AddressName, T_Address.CompanyID, T_Company.CompanyID FROM T_Address, T_Company WHERE T_Address.CompanyID=T_Company.CompanyID;

    This does not work however, and when I click the drop down, I get a list of all options in stored in the AddressName field. If someone could point me in the right direction, I would be very grateful.

    Thank You


  2. #2
    Join Date
    Sep 2002
    South Wales
    You could maybe refer to the value of the control on the form:-

    SELECT T_Address.AddressName, T_Address.CompanyID, T_Company.CompanyID FROM T_Address, T_Company WHERE T_Address.CompanyID=Forms!YourFormName.YourCompany IDControlNameOn;

    Give that a try and let us know how you get on.
    Windows Server 2003-8 / Terminal Services / SQL 2000 / Access 2003 / Office 2003-7 / Exchange 2003-7 / Blackberry Enterprise Server / AutoCAD / Lambert And Butler / Red Bull

  3. #3
    Join Date
    Nov 2007
    Adelaide, South Australia
    Or maybe simpify?

    SELECT AddressName, CompanyID FROM T_Address WHERE CompanyID=Forms!YourFormName!YourCompany;
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!

    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

Posting Permissions

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