sorting

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • favor08
    New Member
    • Jan 2007
    • 56

    sorting

    I have a text box and the control souce says:

    =fCntProdRec([Prodcd]

    I have a label that I want the users to be able to click on that will sort this text box in descending and ascending order, but I am not show to do that when the control source is setup this way.

    I had to take it out of the query that I was running where I had xx:fCntProdRec([Prodcd]) and then I could sort by referencing the xx.
    Code:
    Static blFlag As Boolean
    Me.OrderByOn = True
    If blFlag = False Then
    Me.OrderBy = "[xx]"
    Else
    Me.OrderBy = "[xx]desc"
    End If
    blFlag = Not blFlag
    End Sub
    but it was causing the form to load so slow and changing it to the the above way has improved the response time. Just not sure how to sort now.
    Last edited by NeoPa; Mar 23 '07, 12:13 PM. Reason: Tags
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32633

    #2
    This is difficult to understand as you don't explain what you're referring to. I guess there's some sort of Form or Report involved but I can't work trying to guess what you should have said in your explanation. If you can manage to make the question clear, I'll see what I can do to help.

    Comment

    • MMcCarthy
      Recognized Expert MVP
      • Aug 2006
      • 14387

      #3
      Originally posted by favor08
      I have a text box and the control souce says:

      =fCntProdRec([Prodcd])

      I have a label that I want the users to be able to click on that will sort this text box in descending and ascending order, but I am not show to do that when the control source is setup this way.

      I had to take it out of the query that I was running where I had xx:fCntProdRec([Prodcd]) and then I could sort by referencing the xx.
      Code:
      Static blFlag As Boolean
      Me.OrderByOn = True
      If blFlag = False Then
      Me.OrderBy = "[xx]"
      Else
      Me.OrderBy = "[xx]desc"
      End If
      blFlag = Not blFlag
      End Sub
      but it was causing the form to load so slow and changing it to the the above way has improved the response time. Just not sure how to sort now.
      Is the textbox still named [xx]?

      Comment

      • camp
        New Member
        • May 2007
        • 1

        #4
        I just want to say THANK YOU! Your post has allowed me to solve a problem that his been plaguing me for three days, i.e. getting a form to open in a particular sort order regardless of how the users may have sorted it in the past. That is to say, I needed the form to open in a "default" sort order and not the last saved sort order.

        My OnOpen event procedure now has lines 2 & 4 of your code:

        Me.OrderByOn = True
        Me.OrderBy = "[myfieldname]"

        It works BEAUTIFULLY, so THANK YOU!

        I hope your problem was also solved satisfactorily.

        Comment

        • NeoPa
          Recognized Expert Moderator MVP
          • Oct 2006
          • 32633

          #5
          Well Camp, I have to say it was nice of you to register as a member just to come in and say thanks to Favor. Good for you. I hope you find much more of interest and of use in The Scripts :)

          Comment

          Working...