Solved

How to order by date in access vba command?

Posted on 2010-11-24
3
324 Views
Last Modified: 2012-05-10
I have the following code
DoCmd.OpenForm "comform", , , "FundName='" & Me.List39.Value & "'", , acDialog

how would I make it so when it opens the form it will sort them by date?
0
Comment
Question by:awesomejohn19
3 Comments
 
LVL 47

Accepted Solution

by:
Dale Fye (Access MVP) earned 500 total points
ID: 34205717
The form has an OrderBy property, so you could set that property in the forms design view, in the property dialog.

You could also use an OrderBy clause in the query that is the recordsource for the form.
0
 
LVL 39

Expert Comment

by:als315
ID: 34205807
You can add two strings after docmd:
Forms!comform.orderby = "ID DESC"
Forms!comform.OrderByOn = True
in "" - field and sequence.
0
 
LVL 19

Expert Comment

by:MINDSUPERB
ID: 34205885
With als315 comment, you may try this one as well:

Forms!conform.OrderBy = "YourDateField DESC"
Forms!conform.OrderByOn = True

You may use ASC for ascending.

Sincerely,
Ed
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

708 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now