Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / November 2005

Tip: Looking for answers? Try searching our database.

OrderBy property in Form_Open event

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
ctdak - 24 Nov 2005 02:24 GMT
I have tried to place "Me.OrderBy = [Fieldname]" in a Form_Open event, but it
seems to be ignored.  Is it not possible to establish the order of records in
the recordsource behind a form in code this way?

I know you can set the Order By form property in the form itself, but I want
to order the records conditionally in code, one order if opened for one
reason and another order if opened for another reason.

ctdak
Rick Brandt - 24 Nov 2005 02:27 GMT
> I have tried to place "Me.OrderBy = [Fieldname]" in a Form_Open
> event, but it seems to be ignored.  Is it not possible to establish
[quoted text clipped - 6 lines]
>
> ctdak

You are loading the gun but not pulling the trigger :-)

You also need...

Me.OrderByOn = True

Signature

I don't check the Email account attached
to this message.     Send instead to...
RBrandt    at       Hunter      dot      com

ctdak - 25 Nov 2005 07:32 GMT
OK, thanks.  The gun is now fired!

It seems a little odd to me though.  OrderBy has a default of False, but if
you set it to True in code, then I notice that the form's Order By property
gets loaded with the field name(s).  This means that if you remove the = True
code instead of changing it to = False, the ordering will continue unless you
also remove it from the form property.  This could be a real gotcha.

It seems that it would be better if the form property were NOT loaded like
this at all.  Then you could just put the OrderBy code line in with field
listed, or not, with no need to turn it on or off.

ctdak

> > I have tried to place "Me.OrderBy = [Fieldname]" in a Form_Open
> > event, but it seems to be ignored.  Is it not possible to establish
[quoted text clipped - 12 lines]
>
> Me.OrderByOn = True
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.