Solved

sort the records in a form using 2 criteria

Posted on 2011-03-09
9
378 Views
Last Modified: 2012-05-11
How could I see the records in a form using 2 criteria, the date(chronologic order) in a field and ordre alphabetic in another field.
Thank you
0
Comment
Question by:marian68
[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
  • 5
  • 3
9 Comments
 
LVL 1

Expert Comment

by:kavik379
ID: 35087259
Create a query to use as the record source of the form that uses the two criteria you want to Order By.
0
 
LVL 75
ID: 35087285
Maybe using a query as the Record Source for the form ... example:

SELECT Table1.*
FROM Table1
ORDER BY Format([End Date],"yyyymmdd"), Table1.FIELD1;


mx
0
 

Author Comment

by:marian68
ID: 35087423
The form is rather complex. I can not afford to build the form again based on the query you are proposing.
Other ideas?
Thank you
0
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform) earned 250 total points
ID: 35087527
You can try this code if the Form Load event:

Private Sub Form_Load()
   
    Me.OrderBy = "[YourDateFieldName], [YourOtherFieldName]"
    Me.OrderByOn = True
End Sub


"I can not afford to build the form again based on the query you are proposing."
But that is *very* easy to do ... requires virtually no change.

mx

0
 

Author Closing Comment

by:marian68
ID: 35087769
Thank you. It works.
"But that is *very* easy to do ... requires virtually no change."
Could you tell me how to do that or give me some hints?
Thank you
0
 
LVL 75
ID: 35087880
"Could you tell me how to do that or give me some hints?"
Sure ...
Your Form is currently based on a table, right ?

See the steps below ... just create the SQL off of the existing table and make that the RecordSource - or same it as a Named query ... and use that query.

mx
Capture1.gif
Capture2.gif
Capture3.gif
Capture4.gif
Capture5.gif
0
 

Author Comment

by:marian68
ID: 35087995
Thanks a lot.
0
 
LVL 75
ID: 35088027
you are welcome ...

mx
0
 
LVL 75
ID: 35088039
Best to save the newly created query (SQL) as a saved query in the db window, then use that as the RecordSource.  But either way requires no change to the Form really.

mx
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 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 …
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…

688 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