Results 1 to 6 of 6
  1. #1
    yrstruly is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2024
    Posts
    122

    Help with Cascading Combo Boxes. Drop Downs does nothing

    Hi everyone,
    I'm trying to create a cascading combo box on a form and I'm really stuck. I've followed several guides, but I must be missing something simple.
    My GoalOn my form frmPlumEvaluations, I want the user to:

    1. Select an IPOwner from a combo box (cboIPOwner).
    2. Have the PlantID combo box (cboPlantID) filter to show only the plants for that owner.
    3. When a PlantID is selected, the Cultivar and Block controls should auto-populate.


    What I've DoneMy form, frmPlumEvaluations, has its Record Source property set to a table named tblPlum. This is the table the form saves data to.
    I've named my controls on the form as follows:

    • IP Owner Combo Box: cboIPOwner
    • PlantID Combo Box: cboPlantID
    • Cultivar Combo Box: cboCultivar


    SQL for the PlantID Combo Box (cboPlantID)I've set the Row Source for cboPlantID to:
    SQL

    SELECT DISTINCT PlantID
    FROM tblPlum
    WHERE IPOwner = [Forms]![frmPlumEvaluations]![cboIPOwner]
    ORDER BY PlantID;




    VBA CodeIn the After Update event for the cboIPOwner combo box, I have this code:
    VBA

    Private Sub cboIPOwner_AfterUpdate()
    Me.cboPlantID = Null
    Me.cboCultivar = Null
    Me.cboBlock = Null

    Me.cboPlantID.Requery


    End Sub



    And in the After Update event for the cboPlantID combo box, I have this:
    VBA

    Private Sub cboPlantID_AfterUpdate()
    If Not IsNull(Me.cboPlantID) Then
    Me.cboCultivar = DLookup("Cultivar", "tblPlum", "PlantID = '" & Me.cboPlantID & "'")
    Me.cboBlock = DLookup("Block", "tblPlum", "PlantID = '" & Me.cboPlantID & "'")
    End If
    End Sub




    The ProblemNo matter what I do, when I click the dropdown for the PlantID combo box, I get the "Enter Parameter Value" popup asking for Forms!frmPlumEvaluations!cboIPOwner.
    I have double- and triple-checked that my form is named frmPlumEvaluations and the control is named cboIPOwner. I even checked for case sensitivity.
    I feel like I'm so close but I just can't see the mistake. Any help or suggestions would be hugely appreciated!




    Some SAMPLE DATA:
    Code:
    PlantID	Cultivar	IPOwner	IP Eienaar	BlockAP0482	G.969	1179	Cornell Center for Technology Enterprise	T7B G6969
    AP0482	G.969	1179	Cornell Center for Technology Enterprise	T8 G969
    AP0482	G.969	1179	Cornell Center for Technology Enterprise	T8 G969
    AP0390	G.969	1179	Cornell Center for Technology Enterprise	TC G6969

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 11 Access 2021
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    For posting tabular data, use the table builder on the Advanced post toolbar. Can even copy/paste from Access table or Excel.
    Code should go between CODE tags.
    Note how the first two lines in CODE tagged text are combined to one. This is a flaw in the site and have to edit post to separate the lines into two.

    Don't need DLookup(). Include the Cultivar and Block fields as columns of combbox then reference those columns by index in textbox expression. Index begins with 0 so if field is in column 3, its index is 2.
    =Me.cboPlantID.Column(x)
    Not clear to me why you have comboboxes for Cultivar and Block.

    Why are there duplicate rows for a PlantID? Why are you repeating owner name in table? Should be saving only IPOwner.

    Although what you have should work, assuming these comboboxes are all on same form, don't need full form reference for combobox.
    WHERE IPOwner = [cboIPOwner]
    Try deleting combobox and rebuilding.

    If you want to provide db for analysis, follow instructions at bottom of my post.
    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.

  3. #3
    yrstruly is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2024
    Posts
    122
    Ip Owner can have multiple cultivars, plants, blocks, etc. So text boxes won't work. The user needs to select the related data after the IP owner has been selected.

  4. #4
    XeviBatlle is offline Novice
    Windows 11 Office 365
    Join Date
    Aug 2025
    Posts
    2
    If Me.cboPlantID is a numeric value then you must change the DLookup code:
    Code:
    Me.cboCultivar = DLookup("Cultivar", "tblPlum", "PlantID = " & Me.cboPlantID)
    Me.cboBlock = DLookup("Block", "tblPlum", "PlantID = " & Me.cboPlantID )
    But it seems to me that Me.cboPlantID is not numeric, so the code is OK,

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 11 Access 2021
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Whether textbox or combobox, still don't need DLookup. Even VBA can reference combobox columns by index.

    What table are you populating with these combobox selections?

    Probably be helpful to provide db for analysis.
    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.

  6. #6
    jojowhite's Avatar
    jojowhite is online now Competent Performer
    Windows 11 Access 2021
    Join Date
    Jan 2025
    Posts
    432
    if program is asking for the Parameter, check the spelling of the Form name or is the cboIPOwner in a subform?

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

Similar Threads

  1. Replies: 3
    Last Post: 05-06-2021, 08:33 AM
  2. Combo Box Drop-Downs
    By victor2525 in forum Access
    Replies: 6
    Last Post: 03-05-2018, 04:08 PM
  3. Cascading Drop Downs Based on Previous Selection
    By KirstyAmanda in forum Forms
    Replies: 6
    Last Post: 05-05-2017, 07:13 AM
  4. Replies: 2
    Last Post: 03-06-2015, 01:13 PM
  5. Drop downs and serching in subforms
    By joelwebster in forum Forms
    Replies: 0
    Last Post: 12-13-2009, 03:38 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