I am trying to develop a button (or combobox or option group) that would toggle the sort in a separate combobox that has two columns -- SKU, and Product Name. I would like to toggle between sort by SKU ascending (A-Z), or by Product Name ascending.
Currently, I have SKU ascending as the default when the form loads. I am able to toggle to Product Name ascending once via a combobox. However, I am not able to toggle back again! I can toggle once, but not toggle continuously.
Any help?
Code:
Private Sub Combo13_AfterUpdate()
Dim strSQL As String
Dim strSQLa As String
strSQL = "SELECT qryData.SKU AS [Product SKU], qryData.ProdName AS [Product Name] " & _
"FROM qryData"
'SKU ascending
Select Case Combo13.Value
Case "SKU"
strSQLa = strSQL & "ORDER BY qryData.SKU ASC;"
'Product Name ascending
Case "ProductName"
strSQLa = strSQL & "ORDER BY qryData.ProdName ASC;"
End Select
Me.cboProdSelect.RowSourceType = "Table/Query"
Me.cboProdSelect.RowSource = strSQLa
End Sub