Solved

OrderByOn property of a form...

Posted on 1998-02-23
3
283 Views
Last Modified: 2008-03-04
hi

i have a form with several buttons to allow the user to sort the data, eg button 1 to sort by date.

i achieve this using:
  Forms("Order Form").OrderBy = "Order.[Date]"

whenever i reopen the form, the form remembers the previous OrderBy and performs the sort. my question is how do i prevent the sort when the form opens?

i know i need to use the OrderByOn property of the form but i am not sure when to set this porperty. i have tried setting it on the onOpen event but that didn't work because the sort would have started already.

keith
0
Comment
Question by:keithcsl
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 3

Accepted Solution

by:
guillems earned 20 total points
ID: 1969045
I use the event Load, to prevente the use of the order by

Private Sub Form_Load()
  Me.OrderByOn = False
End Sub

And when I want to use the order by, I have a button (in my test) to do:

Private Sub button1_Click()
  Me.OrderBy = "Order.[date]"
  Me.OrderByOn = True
End Sub

I hope that help you.
0
 
LVL 1

Author Comment

by:keithcsl
ID: 1969046

i have tried the code and yes, it did prevent the sort. however, according to the help file, the onLoad event comes after the onOpen event. how would placing the OnOrderBy property on the onLoad prevent the sort?

then when i tried the code on the onOpen, it also prevented the sort. this means that i made a mistake in my question.

i have experimented more with this problem and found a better way to solve my problem. well, my form requires the user to exit the form via a button. before calling the docmd.close, i have the code

 me.orderbyon = false
 me.orderby = ""

this will erase any previous orderBy property, hence i do not have to check for it whenever i open the form. the only problem is that when the user clicks on the X button to close the form, i cannot insert my code before the onClose event. i can disable the X button but i would prefer not to. i'll be posting this new question later, so i am not expecting an answer from u. but any ideas and comments would be most appreciated.

Thanks
keith
0
 
LVL 3

Expert Comment

by:guillems
ID: 1969047
There's a util form in the Neptuno database, that the form shows the all events. Check in this form, and you'll see all the events, because the help, is wrong in some aspects.

And thanks for the points.

0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question