Results 1 to 3 of 3
  1. #1
    Zara D is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2017
    Posts
    6

    Unhappy Code for cascading combo box

    Hello,

    My issue is the following:

    In the Entry form of the attached data base, I am trying to set up the Contract and Contract Sub-type combo boxes based on the following logic:

    If Procure21 = "Yes", the only option for Contract should be "JCT", and for Contract Sub-type the only option should be "Design and Build".

    However, if Procure21 = "No", there should be two option for Contract - "NEC ECC" and "JCT". Then, depending on the selected value (NEC ECC or JCT respectively), separate lists for each of these should be generated in the Contract Sub-type.

    In the attached file the dependency between the Contract and Contract Sub-type combo boxes is set correctly based on queries on linked tables.

    I have wasted so many days trying to make the final link to the Procure 21 combo box but I am struggling. Could you please please help??

    Thank you!
    Attached Files Attached Files

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    youd have a table of the yes,no options:
    yes, JCT
    no, NEC ECC
    no, JCT

    and options for the chosen Contracts:
    JCT, design & build
    etc


    cbo1, Proc21, gets picked,
    the other combos use Proc21, in their critiera.
    then refresh the other combos.

    subcontract qry sql would look like:
    select subContract from table where [contract]=forms!myForm!procedur21

    but you must refresh after the pick:

    Code:
    sub Procure21_Afterupdate()
        subConract.requery
    end sub
    The same way youd refresh City combo, after picking state combo
    Code:
    sub cboState_Afterupdate()
        cboCity.requery
    end sub
    the city combo query sql:
    select city from table where [state]=forms!myForm!cboState

  3. #3
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Take a look at this...

    Here's a link to all kinds of information and examples for Comboboxes


    Your design is not the way I would create my dB, but I have my own quirks.....
    I removed all of the spaces in names, renamed the PK/FK fields and removed the macros - replaced with code...

    Tear this apart...... Have fun!
    Attached Files Attached Files

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

Similar Threads

  1. Cascading Combo Box help
    By kspabo in forum Access
    Replies: 11
    Last Post: 06-27-2014, 01:00 PM
  2. Replies: 1
    Last Post: 02-27-2014, 03:43 PM
  3. Replies: 8
    Last Post: 10-22-2012, 01:24 PM
  4. Replies: 8
    Last Post: 03-14-2011, 09:45 AM
  5. Ideas on shorter code for cascading updates
    By usmcgrunt in forum Programming
    Replies: 3
    Last Post: 12-03-2010, 12:17 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