[AccessD] Turn a recordset into an actual table

Bill Benson bensonforums at gmail.com
Wed Oct 27 18:16:05 CDT 2021


Didn’t know the first part (character limit) - thanks for that Stuart.

Second part I figured N/A in Arthur’s use case but yeah there’s that. Good
you made it clear.

OTOH, if my code creates the recordset I would think the SQL is already
pretty available in my code or in a string variable.

On Wed, Oct 27, 2021 at 5:43 PM Stuart McLachlan <stuart at lexacorp.com.pg>
wrote:

> But not necessarily all of the SQL.  :)
>
> As MS tells us:
> "The Name property of a Recordset object opened by using an SQL statement
> is
> the first 256 characters of the SQL statement".
>
> Adn if a Form's record source is a table, its recordset's Name is just the
> table name.
>
>
>
> On 27 Oct 2021 at 10:05, Bill Benson wrote:
>
> > Which property gives you the SQL may depend on the type of recordset
> > (DAO or ADO). If DAO, I think it is the name property of the recordset
> >
> > On Wed, Oct 27, 2021 at 9:04 AM Arthur Fuller
> > <fuller.artful at gmail.com> wrote:
> >
> > > Thanks, Stuart
> > > What would be the equivalent to display the SQL for a named Record
> > > Set rather than a QueryDef?
> > >
> > > On Tue, Oct 26, 2021 at 5:58 PM Stuart McLachlan
> > > <stuart at lexacorp.com.pg> wrote:
> > >
> > > > On 26 Oct 2021 at 11:22, Arthur Fuller wrote:
> > > >
> > > > > The code depends on the existence of a named RecordSet....
> > > > >  button that builds a SQL In() clause
> > > > > from the selected Machine IDs. I plug the resultant In() clause
> > > > > into a queryDef. But I want to be able to browse the result as
> > > > > if it were an actual table....
> > > > >To begin with, I need a tool that, given the name of a QueryDef,
> > > > >shows
> > > me
> > > > the SQL.
> > > >
> > > >
> > > > You appear to be conflating the concepts of Recordset and
> > > > QueryDef.
> > > >
> > > > If you have a QueryDef, you can open it in the QBE grid with
> > > > Docmd.Openquery.
> > > > You can get it's SQL by using th QueryDef object's SQL property
> > > >
> > > > Function ShowQuery() As Long
> > > > Dim strQName As String
> > > > Dim qd As QueryDef
> > > > strQName = "qryMyQuery"
> > > > Set qd = CurrentDb.QueryDefs(strQName)
> > > > MsgBox qd.Name
> > > > MsgBox qd.SQL
> > > > DoCmd.OpenQuery strQName
> > > > End Function
> > > >
> > > >
> > > > --
> > > > AccessD mailing list
> > > > AccessD at databaseadvisors.com
> > > > https://databaseadvisors.com/mailman/listinfo/accessd
> > > > Website: http://www.databaseadvisors.com
> > > >
> > >
> > >
> > > --
> > > Arthur
> > > --
> > > AccessD mailing list
> > > AccessD at databaseadvisors.com
> > > https://databaseadvisors.com/mailman/listinfo/accessd
> > > Website: http://www.databaseadvisors.com
> > >
> > --
> > AccessD mailing list
> > AccessD at databaseadvisors.com
> > https://databaseadvisors.com/mailman/listinfo/accessd
> > Website: http://www.databaseadvisors.com
> >
>
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> https://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>


More information about the AccessD mailing list