Results 1 to 4 of 4
  1. #1
    Blings's Avatar
    Blings is offline Competent Performer
    Windows 10 Office 365
    Join Date
    May 2020
    Location
    London, UK
    Posts
    125

    Cascading combo box ascending update

    I am trying to sort a combo box ascending on the after update event of cboCategory. I have tried to sort by Ascending in the query, however, it strangely doesn't seem to reflect the order of ascending on the cboCode combo box after the cascade of data from cboCategory on the form. Can this be done in line 31 with a of bit of VB?

    [CODE] Dim sSource As String

    20 sSource = "SELECT [tblElementDetails].[ElementDetailID], [tblElementDetails].[EquipmentTypeID], [tblElementDetails].
    Code:
    , [tblElementDetails].[Desc], [tblElementDetails].[CostPrice], [tblElementDetails].[SalePrice], [tblElementDetails].[LastUpdated]  " & _
          "FROM tblElementDetails " & "WHERE [EquipmentTypeID] = " & Me.cboCategory
    
    
    30    Me.cboCode.RowSource = sSource
    31    Me.cboCode.Column (2)


  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,518
    More like here:

    "FROM tblElementDetails " & "WHERE [EquipmentTypeID] = " & Me.cboCategory & " ORDER BY FieldName"
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Blings's Avatar
    Blings is offline Competent Performer
    Windows 10 Office 365
    Join Date
    May 2020
    Location
    London, UK
    Posts
    125
    Quote Originally Posted by pbaldy View Post
    More like here:

    "FROM tblElementDetails " & "WHERE [EquipmentTypeID] = " & Me.cboCategory & " ORDER BY FieldName"
    Your knowledge is impeccable, that fixed it, thank you!

    Solution:-
    Code:
    "FROM tblElementDetails " & "WHERE [EquipmentTypeID] = " & Me.cboCategory & " ORDER BY Code"

  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,518
    Happy to help!
    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. Update a Cascading Combo Box
    By JonathanT in forum Forms
    Replies: 9
    Last Post: 02-21-2021, 01:41 PM
  2. Replies: 7
    Last Post: 12-09-2014, 12:24 PM
  3. Replies: 2
    Last Post: 09-10-2013, 09:10 AM
  4. Replies: 6
    Last Post: 02-01-2013, 10:02 AM
  5. Replies: 7
    Last Post: 12-29-2011, 10:13 AM

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