Shamil Salakhetdinov
shamil at smsconsulting.spb.ru
Tue Nov 30 06:27:21 CST 2010
Hi Brad -- That code line should work: CurrentDB.QueryDefs("YourQueryNameHere").Properties.Delete("OrderBy") Put On Error Resume Next before it or check that "OrderBy" property exists before executing the above code line to suppress/avoid runtime error in the case "OrderBy" property doesn't have any value stored for your query. Thank you. -- Shamil -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Brad Marks Sent: 30 ?????? 2010 ?. 2:00 To: Access Developers discussion and problem solving Subject: [AccessD] Is it possible to use VBA to clear out the "Order By"property of a Query in Access 2002? We are making minor changes to an Access 2002 application. We would like to always clear any fields in the "Order By" property of a specific query so that each time the query is opened fresh, the sort reverts back to the sort fields specified in the query itself. We would like to still allow sorting when the query is opened, but we would like to wipe out any "Order By" fields that someone may have accidently saved when they were exiting the application. Thanks, Brad -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com