William Benson (VBACreations.Com)
vbacreations at gmail.com
Tue Jun 21 18:42:27 CDT 2011
That's It ... OrderByOn and OrderBy ... I was looking under Sort. Thank you so VERY MUCH! -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Bob Gajewski Sent: Tuesday, June 21, 2011 6:41 PM To: 'Access Developers discussion and problem solving' Subject: Re: [AccessD] Storing and reapplying a sort William Do you have the default sort (Order By) defined in the RecordSource of the subform? Example: SELECT tblMembersResponses.ResponseID, tblMembersResponses.IncidentID, tblMembersResponses.MemberNumber, tblMembersResponses.LastUpdated FROM (tblMembers INNER JOIN tblMembersResponses ON tblMembers.MemberNumber=tblMembersResponses.MemberNumber) INNER JOIN tblIncidents ON tblMembersResponses.IncidentID=tblIncidents.IncidentID ORDER BY tblMembersResponses.ResponseID; If it's a static sort, that's the easiest way ... If you need a dynamic sort, you can define the criteria into a variable (strSortOrder in example below): Dim frm As Form Set frm = Forms(sfrmYourSubFormName) frm.OrderByOn = True frm.OrderBy = strSortOrder Regards, Bob Gajewski -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of William Benson (VBACreations.Com) Sent: Tuesday, June 21, 2011 12:16 PM To: 'Access Developers discussion and problem solving' Subject: [AccessD] Storing and reapplying a sort I have a subform in datasheet view. When sorted, and I refresh the datasource, I am losing the sort. What property can I read to find out the currently applied sort? And can someone type me a line of code that will apply a sort? Thanks -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com