A
alex
Query Def not recognized
Hello,
Using Access ’03…
I’ve created a qdf in VBA and I’d like to use it as part of another
query…
My problem, is that the qdf is not being recognized; i.e., when the
query runs, I get a parameter box asking for a value?
Here’s some of my code:
‘’’’’’’’’’’’’’’’
Set dbs = CurrentDb
Dim strQDFname As String
strQDFname = "myQryDef" 'query def name
With dbs
Set qdf = .CreateQueryDef(strQDFname, strQDFsql)
qdf.Close
End With
Set qdf = Nothing
‘sql code using qdf
Dim strSQL As String
strSQL = _
" myQryDef.Field1, " & _
" myQryDef. Field2, " & _
" myQryDef. Field3, " & _
" myQryDef. Field4, " & _
" myTable.Field1, " & _
" myTable. Field2, " & _
" myTable. Field3, " & _
" myTable. Field4 "
‘’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’
I can see the query object (myQryDef) and I can use it with other
query objects (I can even run it by just clicking on it); I just can’t
use it w/ VBA for some reason? Do I need to append it to some
collection?
Any thoughts?
alex
Hello,
Using Access ’03…
I’ve created a qdf in VBA and I’d like to use it as part of another
query…
My problem, is that the qdf is not being recognized; i.e., when the
query runs, I get a parameter box asking for a value?
Here’s some of my code:
‘’’’’’’’’’’’’’’’
Set dbs = CurrentDb
Dim strQDFname As String
strQDFname = "myQryDef" 'query def name
With dbs
Set qdf = .CreateQueryDef(strQDFname, strQDFsql)
qdf.Close
End With
Set qdf = Nothing
‘sql code using qdf
Dim strSQL As String
strSQL = _
" myQryDef.Field1, " & _
" myQryDef. Field2, " & _
" myQryDef. Field3, " & _
" myQryDef. Field4, " & _
" myTable.Field1, " & _
" myTable. Field2, " & _
" myTable. Field3, " & _
" myTable. Field4 "
‘’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’
I can see the query object (myQryDef) and I can use it with other
query objects (I can even run it by just clicking on it); I just can’t
use it w/ VBA for some reason? Do I need to append it to some
collection?
Any thoughts?
alex