Page 2 of 2 FirstFirst 12
Results 16 to 21 of 21
  1. #16
    svrich is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Mar 2014
    Posts
    23
    Its the same criteria I used to select the row source for the first combo box (Just a different column name). Below is the second combo box's set-up.

    Property Sheet > Data > Row Source



    SELECT DISTINCT [L_I_GEO].[LONG] FROM L_I_GEO ORDER BY [LONG]

  2. #17
    svrich is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Mar 2014
    Posts
    23
    Here's the cascade code. Country is Box 1 of the cascade and Region is Box 2 of the cascade

    Private Sub Country_AfterUpdate ()
    Dim strSource As String

    strSource = "SELECT Long_Name " &_
    "FROM L_I_GEO " &_
    "WHERE Short_Name = '" & Me.Country & "' ORDER BY Long_Name"
    Me.Region.RowSource = strSource
    Me.Region = vbNullString
    End Sub

  3. #18
    svrich is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Mar 2014
    Posts
    23
    Oops. Found a spelling error. That fixes why its showing blank. Still not sure why its not showing the DISTINCT though.

    My second box is returning all values associated with the first instead of just a single of each DISTINCT.

  4. #19
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    The DISTINCT is not included in your cascade code.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #20
    svrich is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Mar 2014
    Posts
    23
    Where would the DISTINCT go in the cascade code? Would it look like the code below?

    Private Sub Country_AfterUpdate ()
    Dim strSource As String

    strSource = "SELECT Long_Name " &_
    "FROM L_I_GEO " &_
    "WHERE Short_Name = '" & Me.Country & "' ORDER BY Long_Name"
    Me.Region.RowSource = DISTINCT strSource
    Me.Region = vbNullString
    End Sub

  6. #21
    svrich is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Mar 2014
    Posts
    23
    Omg. I feel like an idiot. At least the VBA editor has the compile tool for trial and error. Thank you for all your help Paul.

    strSource = "SELECT DISTINCT Long_Name " &_

    Quick question

    Is there a "count record" (or value) for records meeting a certain criteria?

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 10-01-2013, 09:25 PM
  2. Filter Combo box - Help
    By mar_t in forum Forms
    Replies: 3
    Last Post: 01-31-2011, 07:08 AM
  3. filter value in a combo box
    By dada in forum Programming
    Replies: 3
    Last Post: 09-05-2010, 01:22 PM
  4. Combo Box filter – help!
    By catat in forum Forms
    Replies: 1
    Last Post: 08-24-2010, 04:15 PM
  5. Combo Box Filter
    By jgelpi in forum Programming
    Replies: 3
    Last Post: 07-27-2009, 12:54 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