Chris 655321
Aug 15th, 2000, 08:54 AM
I'm trying to create a command in a form that will sort the data in the form by ascending or descending order. I am currently trying to use a toggle switch, and using the following code:
Dim str As String, tgl As ToggleButton
str = "Customers_CompanyName"
Set tgl = tglCustomer
Select Case tgl.Value
Case True
Me.OrderBy = str & " DESC"
Me.OrderByOn = True
Case False
Me.OrderByOn = False
Case Else
Me.OrderBy = str
Me.OrderByOn = True
End Select
The toggle button is a MicrosoftFormsLibrary2.0 toggle switch.
When I run this, I usually get a 'type mismatch' error.
Are there better ways to do what I'm doing?
Dim str As String, tgl As ToggleButton
str = "Customers_CompanyName"
Set tgl = tglCustomer
Select Case tgl.Value
Case True
Me.OrderBy = str & " DESC"
Me.OrderByOn = True
Case False
Me.OrderByOn = False
Case Else
Me.OrderBy = str
Me.OrderByOn = True
End Select
The toggle button is a MicrosoftFormsLibrary2.0 toggle switch.
When I run this, I usually get a 'type mismatch' error.
Are there better ways to do what I'm doing?