LevelThought
MIS
Currently using the following code to sort a listbox on a Access form;
Dim strSQL as String
strSQL = "SELECT Company, [First Name], [Last Name] FROM YourTable"
Select Case Me.[YourOptionGroup].Value
Case 1
strSQL = strSQL & " ORDER BY Company"
Case 2
strSQL = strSQL & " ORDER BY [First Name]"
Case 3
strSQL = strSQL & " ORDER BY [Last Name]"
Case Else
MsgBox "What to do with " & Me.[YourOptionGroup].Value
End Select
Me.[YourListBox].RowSource = strSQL & ";"
The issue that I am having is that the sort works ok if I only specify four columns of data in my listbox. If I display more than four columns of data, then, upon sorting using the option buttons, all of the columns other than the four sorted columns are blank!
Any insight as to how I would resolve this?
Thanks in advance.
Dim strSQL as String
strSQL = "SELECT Company, [First Name], [Last Name] FROM YourTable"
Select Case Me.[YourOptionGroup].Value
Case 1
strSQL = strSQL & " ORDER BY Company"
Case 2
strSQL = strSQL & " ORDER BY [First Name]"
Case 3
strSQL = strSQL & " ORDER BY [Last Name]"
Case Else
MsgBox "What to do with " & Me.[YourOptionGroup].Value
End Select
Me.[YourListBox].RowSource = strSQL & ";"
The issue that I am having is that the sort works ok if I only specify four columns of data in my listbox. If I display more than four columns of data, then, upon sorting using the option buttons, all of the columns other than the four sorted columns are blank!
Any insight as to how I would resolve this?
Thanks in advance.