I've got an Access 2003 application that I'm developing, and it works great except for 1 remaining bug.
I can't seem to delete a QueryDef from the collection. The code for this follows:
For Each qdf In db.QueryDefs
'MsgBox (qdf.Name)
If qdf.Name = "qryTemp2" Then db.QueryDefs.Delete "qryTemp2"
Next qdf
This temporary query may or may not be created at some point depending on the options that the user has chosen. What I'm not understanding is that when qdf.name="qryTemp2" I'm getting a runtime 3011 error saying that the Jet Database Engine could not find the object qryTemp2.
It doesn't show up in the database window, but no matter what I do, I can't seem to remove this name from the Querydefs collection.
By the way, i set qdf as:
Dim qdf As DAO.QueryDef
I haven't had any problems like this in any of the other applications I've been developing and I don't understand it. Any help would be greatly appreciated.
Our community of experts have been thoroughly vetted for their expertise and industry experience.