Returns a QueryDef object that is a copy of the QueryDef used to create the Recordset object represented by the recordset placeholder (Microsoft Jet workspaces only).
Syntax
Set querydef = recordset.CopyQueryDef
The CopyQueryDef method syntax has these parts.
Part | Description |
querydef | An object variable that represents the copy of a QueryDef object you want to create. |
recordset | An object variable that represents the Recordset object created with the original QueryDef object. |
Remarks
You can use the CopyQueryDef method to create a new QueryDef that is a duplicate of the QueryDef used to create the Recordset.
If a QueryDef wasn't used to create this Recordset, an error occurs. You must first open a Recordset with the OpenRecordset method before using the CopyQueryDef method.
This method is useful when you create a Recordset object from a QueryDef, and pass the Recordset to a function, and the function must re-create the SQL equivalent of the query, for example, to modify it in some way.