Is it possible to query from Recordset?

prabha_friend

Prabhakaran Karuppaih
Local time
Today, 12:21
Joined
Mar 22, 2009
Messages
1,034
Set attnset = CurrentDb.OpenRecordset("TRANSFORM Count(Leave_Absents.Employee) AS CountOfEmployee SELECT Leave_Absents.Code FROM Leave_Absents WHERE (((Leave_Absents.Day) Is Not Null)) GROUP BY Leave_Absents.Code PIVOT MonthName(Month([Day])) In (" & monthchain() & ");")

Set strengthset = CurrentDb.OpenRecordset("TRANSFORM Last(Tbl_Teamstrength_Attendance.Strength) AS LastOfStrength SELECT 'Strength' AS Code FROM Tbl_Teamstrength_Attendance GROUP BY 'Strength' PIVOT MonthName(Month([Dt])) In (" & monthchain() & ");")

After that I need to make a Union Query of the Two Results. Is to possible to query from a Recordset directly?
 
I'm very inexperienced so I may be way off here, but you could try

dim newrs as recordset
set newrs = currentdb.openrecordset("SELECT * From " & attnset.name & " Union All SELECT * FROM " & strengthset.name &";")
 
No, you can't do it that way. Sorry, you would have to create QueryDefs instead of Recordsets to do it.
 

Users who are viewing this thread

Back
Top Bottom