Results 1 to 4 of 4
  1. #1
    P5C768 is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Aug 2009
    Location
    Denver, CO
    Posts
    95

    Default Value for Cascading Combo Box

    I have 2 combo boxes, one of which is populated by the result of the other. In some cases, there is only one possible selection in the combo box dropdown, based on the selections.

    I would like to have the combobox automatically show the single selection, if there is only one possible option. However, if the result of the first selection allows for more than one option in the second combo box, I would like it to remain balnk and let the user choose the result.

    Any help?

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    This type of thing:

    Code:
      If Me.cboCities2.ListCount = 1 Then
        Me.cboCities2 = Me.cboCities2.ItemData(0)
      End If
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    P5C768 is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Aug 2009
    Location
    Denver, CO
    Posts
    95
    Thanks Paul, this works for the 2nd combo box in my set, but the third one that is cascading from the first two no longer requeries after updated and won't go to the default value. Thoughts?

    Here is the code:

    Private Sub CboCname1_AfterUpdate()
    CboPtype1 = vbNullString
    CboPtype1.Requery
    If CboPtype1.ListCount = 1 Then
    CboPtype1 = CboPtype1.ItemData(0)
    End If
    End Sub

    Private Sub CboPtype1_AfterUpdate()
    cboRfreq1 = vbNullString
    cboRfreq1.Requery
    If cboRfreq1.ListCount = 1 Then
    cboRfreq1 = cboRfreq1.ItemData(0)
    End If
    End Sub

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    No longer works implies that it did at one time? Did something in the query change? I'd double check that the query criteria is correct. Can you post the db?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. cascading combo
    By rexb in forum Forms
    Replies: 9
    Last Post: 10-26-2009, 04:10 PM
  2. Cascading Combo Boxes
    By desireemm1 in forum Programming
    Replies: 1
    Last Post: 10-05-2009, 06:00 AM
  3. Cascading Combo Boxes
    By gjw1012 in forum Access
    Replies: 1
    Last Post: 07-25-2009, 04:59 PM
  4. cascading combo form
    By tonysomerset in forum Forms
    Replies: 0
    Last Post: 08-27-2008, 02:10 AM
  5. Cascading Combo Box
    By nywi6100 in forum Forms
    Replies: 0
    Last Post: 10-23-2006, 01:45 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