StarvinMarvin
still quite the noob
- Local time
- Today, 16:19
- Joined
- Mar 8, 2010
- Messages
- 171
I've been trying to find ways to eliminate static queries from an application, attempting to use recordsets as dynamic queries to use as a table in another recordset but that doesn't work. So I found a few posts on querydefs but nothing seems to work for my purpose and I'm not getting the syntax down correctly:
just trying to create a temp querydef that I use in a loop with a recordset that uses the querydef as it would a static query I've already defined.
When the subs done I need the querydef gone.
Code:
Public Sub AvPool()
Dim db As DAO.Database, qdf As QueryDef
Set db = CurrentDb
Set qdf = dbcurrent.QueryDefs("AvPool")
qdf.SQL = "SELECT Emp_no FROM Requests LEFT JOIN Assignments ON Request.Emp_No = Assignments.Emp_No WHERE Assignments.Emp_No IS NULL;"
DoCmd.RunSQL qdf
End Sub
just trying to create a temp querydef that I use in a loop with a recordset that uses the querydef as it would a static query I've already defined.
When the subs done I need the querydef gone.