[AccessD] Is it possible to use VBA to clear out the "OrderBy"property of a Query in Access 2002?

Brad Marks BradM at blackforestltd.com
Tue Nov 30 10:45:35 CST 2010


Paul and Shamil,

Thanks for the help, I appreciate it.

Brad

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Shamil
Salakhetdinov
Sent: Tuesday, November 30, 2010 6:27 AM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Is it possible to use VBA to clear out the
"OrderBy"property of a Query in Access 2002?

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

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.





More information about the AccessD mailing list