Results 1 to 3 of 3

Thread: Can anyone help me with my sorting problem?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Aug 2000
    Posts
    16

    Angry

    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?

  2. #2
    New Member
    Join Date
    Aug 2000
    Posts
    12
    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

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Aug 2000
    Posts
    16
    Nevermind, I got it sorted out.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width