View Single Post
  #10  
Old April 8th, 2009, 04:30 PM posted to microsoft.public.access,microsoft.public.access.forms,microsoft.public.access.formscoding
John S. Ford, MD
external usenet poster
 
Posts: 215
Default Form doesn't sort records per the underlying query

Dirk,

Here is the SQL for the underlying query:

SELECT tblDATA_Admissions.*, tblDATA_Patients.*
FROM tblDATA_Admissions LEFT JOIN tblDATA_Patients ON
tblDATA_Admissions.PatientIDNum = tblDATA_Patients.PatientIDNum
ORDER BY tblDATA_Patients.PatientNameLast,
tblDATA_Patients.PatientNameFirst, tblDATA_Admissions.PatientDateAdmit DESC;

It sorts the data as expected. When I use the form, the sort is unordered.

John

"Dirk Goldgar" wrote in message
...
"John S. Ford, MD" wrote in message
...
I have a form, frmMain that uses a query as its underlying datasource.
The query sorts the records in a certain way. How come the records aren't
sorted the same way by frmMain?

Does it matter that the frmMain is filtered by a WHERE statement passed
by a search form, frmSearch that calls and opens it?


I don't think it should, if you're doing what I think. Would you mind
posting the code that opens the form, including any surrounding, relevant
code? Is it possible that you are modifying the form's RecordSource on
the fly, either in the code that opens the form or in the form's Open
event?

When you say "the query sorts the records in a certain way," do you mean
that the query explicitly sorts the records using an ORDER BY clause? Or
do you just mean that they come out a particular way in the absence of an
explicit ordering?

Does the form show the same sort sequence when you open it from the
database window, rather than from your search form?

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)