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

Paul Hartland paul.hartland at googlemail.com
Tue Nov 30 01:13:06 CST 2010


Brad,

You could call a function similar to the one below before the query opens

Function ResetQuery()
 Dim dbConn As Database
 Dim qdfQry As QueryDef
 Dim strSQL As String
 Set dbConn = CurrentDb
 strSQL = "put the sql of the original query here"
 Set qdfQry = dbConn.QueryDefs("the actual query name here")
 qdfQry = strSQL
 qdfQry.Close
 dbConn.Close
 Set dbConn = nothing
End Function

Paul



On 29 November 2010 22:59, Brad Marks <BradM at blackforestltd.com> wrote:

> 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
>



-- 
Paul Hartland
paul.hartland at googlemail.com



More information about the AccessD mailing list