Results 1 to 2 of 2
  1. #1
    Phred is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Dec 2009
    Posts
    246

    Red face Cascading Combo Box not filtering

    Front end Access 2007. Back end SQL Server 2008 R2.



    I have two combo boxes on the same form. The two tables in the query are normalized with primary keys and foreign keys.

    Combo Box 1: EntityTypeCMB holds the following values:

    PK EntityType
    1 Client
    2 Owner of Record
    3 Complainant Affiant

    Combo Box 2: EntityRelationshipCMB

    FK EntityType
    1 Owner
    2 Individual
    2 Corporation
    2 LLC
    2 Company
    3 Owner
    3 Lessee
    3 Trust Beneficiary

    In the first combo box if you select "Client" the only value that should appear in the second combo box is "Not Applicable"

    In the first combo box if you select Owner of Record four values should appear in the second combo box, "Individual", "Corporation", "LLC", "Company".

    In query builder a relationship is established from the PK of the Entity Type table to its corresponding FK in the RelationshhipType table.

    The first combo box Entity Type works fine. Calls the values from the table, displays the EntityType name "Owner of Record" on the screen and populates the underlying table with the PK in this instance 2.

    I have two problems:

    Problem 1. The "Select" and "From" statements work correct and return the correct values. The "Where" statement is not filtering correctly and does not give me any values. So something is wrong with my Where statement.

    Code:
    SELECT dbo_EntityTypeLookup.EntityID, dbo_EntityRelationshipLookup.EntityRelationship
    FROM dbo_EntityTypeLookup INNER JOIN dbo_EntityRelationshipLookup ON dbo_EntityTypeLookup.EntityID = dbo_EntityRelationshipLookup.EntityTypeLookup_EntityID
    WHERE (([dbo_EntityTypeLookup]![EntityID]=[Forms]![Property]![PropertyEntityJoin].[Form]![EntityID]));
    Problem 2. I am not sure where I should place this SQL statement for best operation. Should it function as a "Row Source" statement or should it be a "stand alone" query that is called from the On Click event from the second combo box.

    I hope I have given enough data.

    Thanks

    Fred

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Be aware that cascading combobox/listbox with lookup alias will not work nice in continuous or datasheet view form.

    Why are you using a join in the SQL? I need better understanding of table structures.

    I suggest placing the SQL statement in RowSource property.

    Also suggest you name the combobox different from the field, like cboEntityID

    SELECT EntityRelationship FROM dbo_EntityRelationshipLookup WHERE [EntityID]=[cboEntityID];
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 8
    Last Post: 06-03-2015, 02:11 AM
  2. Replies: 1
    Last Post: 02-27-2014, 03:43 PM
  3. Replies: 1
    Last Post: 07-12-2012, 08:39 AM
  4. Replies: 5
    Last Post: 03-12-2012, 02:58 AM
  5. Filtering options using Cascading Combo boxes
    By Lincoln in forum Database Design
    Replies: 3
    Last Post: 07-15-2011, 08:25 PM

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