Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

OrderByOn property of a form...

Posted on 1998-02-23
3
Medium Priority
?
315 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 60 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

610 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