[AccessD] Multi-Select List Box problems

Arthur Fuller fuller.artful at gmail.com
Mon Sep 6 10:00:21 CDT 2021


Thanks Stuart. that's a big help.

On Mon, Sep 6, 2021 at 10:48 AM Stuart McLachlan <stuart at lexacorp.com.pg>
wrote:

>
> On 6 Sep 2021 at 9:43, Arthur Fuller wrote:
>
>
> > That's a concrete example. I'll have to rewrite the query each time
> > the process is run, which begs the, How can I access the Criterion
> > part of a named query? this would really simplify matters. I could
> > just refer to the Criteria part and substitute the current selection.
>
> Demo of grabbing a SQL of a saved query and changing it:
>
> Function TestQD()
> Dim qd As QueryDef
> Dim sSQL As String
>
> 'Get existing qryTest
> Set qd = CurrentDb.QueryDefs("qryTest")
> sSQL = qd.SQL
> Debug.Print sSQL
>
> ' change the SQL
> qd.SQL = "SELECT * from tblCustomers"
> qd.Close
>
> 'Get it again to confirm it's changed
> Set qd = CurrentDb.QueryDefs("qryTest")
> Debug.Print qd.SQL
>
> 'Set it back to the original
> qd.SQL = sSQL
> qd.Close
>
> 'Make sure that it's back to original
> Set qd = CurrentDb.QueryDefs("qryTest")
> Debug.Print qd.SQL
> qd.Close
> Set qd = Nothing
> End Function
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> https://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>


-- 
Arthur


More information about the AccessD mailing list