View Single Post
  #17  
Old April 8th, 2009, 05:19 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

Dear Dirk,

I changed the DoCmd.OpenForm to simply open it without the strFinalWHERE and
the OpenArgs argument:

DoCmd.OpenForm "frmAdmissionEntryForm"

and commented out the code using the OpenArgs argument in
frmAdmissionEntryForm.

When I do this, the form's records ARE sorted correctly (but obviously not
filtered). So it appears to be something related to the DoCmd.OpenForm code
I'm using.

John


"Dirk Goldgar" wrote in message
...
"John S. Ford, MD" wrote in message
...

Yes, this is the recordsource for the form (which sorts the data as
expected). The calling form opens it using this code he

DoCmd.OpenForm "frmAdmissionEntryForm", , , strFinalWHERE, , , _
"DCStatus=" & lstDischargeStatusCriteria & _
":Team=" & lstTeamCriteria & _
":Attending=" & cboAttendingCriteria & _
":Resident=" & cboResidentCriteria & _
":Intern=" & cboInternCriteria

strFinalWHERE is a WHERE statement build up by the calling form (which is
a search form). frmAdmissonEntryForm, the form then opens and everything
is perfectly filtered, the right records are shown but they're not sorted
the way the underlying query is sorted.



That is odd. If you open the form directly from the database window (or
navigation pane, if Access 2007), does it open unordered or in sequence
according to the query?

Is there any code (or macros) in the Open or Load events of
frmAdmissionEntryForm?

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

(please reply to the newsgroup)