Hi,
I'm trying to display data from a table using a query.
My code:
The code gets to "set qdf = ..." working just fine
but in the following row I get a message:
"Run-Time Error '7874':
Microsoft Office can't find the object 'tmpQry'."
Does anybody know what I'm doing wrong?
Thanks in advance
Izhar
I'm trying to display data from a table using a query.
My code:
Code:
Dim db As Database Dim rs As Recordset Dim qdf As QueryDef Dim strSql As String Set db = CurrentDb strSql = "SELECT T_MAIN.Name FROM T_MAIN;" Set rs = db.OpenRecordset(strSql, dbOpenSnapshot) With db Set qdf = .CreateQueryDef("tmpQry", strSql) DoCmd.OpenQuery "tmpQry", , acReadOnly .QueryDefs.Delete "tmpQry" End With db.Close qdf.Close
but in the following row I get a message:
"Run-Time Error '7874':
Microsoft Office can't find the object 'tmpQry'."
Does anybody know what I'm doing wrong?
Thanks in advance
Izhar
Comment