Solved

How to order by date in access vba command?

Posted on 2010-11-24
3
331 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
[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
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 40

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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

730 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