[AccessD] Turn a recordset into an actual table

Stuart McLachlan stuart at lexacorp.com.pg
Tue Oct 26 16:58:20 CDT 2021


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




More information about the AccessD mailing list