Graphic

message from Fadoyo on 14 May 2004
Hi all, please I have a report with a graphic. Now the query is built under
design, but I would like to build the query filtered between two querys. How
could I do it with code?

Thanks
Fadoyo
PD: Please, I need help!!!
 
Arvin Meyer replied to Fadoyo on 14 May 2004
In code, you'd do it like the following, but it whill only work once unless
you delete the queries that you create:

Function testit()
Dim qd1 As DAO.QueryDef
Dim qd2 As DAO.QueryDef
Dim qd3 As DAO.QueryDef

Set qd1 = CurrentDb.CreateQueryDef("qry1", "Select * From Table1")
Set qd2 = CurrentDb.CreateQueryDef("qry2", "Select * From Table2")

Set qd3 = CurrentDb.CreateQueryDef("qry3", "SELECT qry2.Whatever FROM qry1
INNER JOIN qry2 ON qry1.IDField = qry2.IDField;")

DoCmd.OpenQuery "qry3"

End Function
 

Archived message: Graphic (MS Access)