PDA

Click to See Complete Forum and Search --> : Can anyone help me with my sorting problem?


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?

fly_phoenix
Aug 15th, 2000, 10:16 AM
I am not that expirienced, so if I'm wrong it's understandable and I am sorry for bothering you, but it seems to me you are trying to assign a string to a logical value

Me.OrderBy = str

I know in other languages this could be the problem

Chris 655321
Aug 15th, 2000, 10:19 AM
Nevermind, I got it sorted out.