I am running basic code to output the contents of querydefs to a file and keep getting a query that does not appear in the queries pane, nor is it used in any procedure.
I have run a compact and repair but am still seeing this query in any list created immediately after.
My question is, at what point is querydefs updated.
I have named "Redundant" queries with a preceding "2" such that if there are no errors regarding said query it can be safely deleted or restored if needs be, hence the second part of the if statement.
Here is a screen shot of three tables with "QBBoxcollectH" showing and a query search window with "qbb" as the search criteria.
I have run a compact and repair but am still seeing this query in any list created immediately after.
My question is, at what point is querydefs updated.
I have named "Redundant" queries with a preceding "2" such that if there are no errors regarding said query it can be safely deleted or restored if needs be, hence the second part of the if statement.
Code:
Set rs = oDB.OpenRecordset("Query_Temp", dbOpenDynaset)
For Each qdf In db.QueryDefs
If InStr(qdf.Name, "~") = 0 And InStr(qdf.Name, "2") = 0 Then
rs.AddNew
rs!query_name = qdf.Name
rs!query_text = qdf.SQL
rs.Update
End If
Next qdf
Here is a screen shot of three tables with "QBBoxcollectH" showing and a query search window with "qbb" as the search criteria.