This is my first posting on a forum so I hope it makes sense. I would appreciate any help available
I run the SQL shown below from a form button using DoCmd.RunSql without any trouble. Table A is a yearly rota for team A. I also have table B for team B, table C for team C etc.
INSERT INTO [All Teams] ( Name, [Tot Hrs] )
SELECT Namelist.Name, Sum(A.[Tot Hrs]) AS [SumOfTot Hrs]
FROM (A INNER JOIN Namelist ON A.Team = Namelist.Team) INNER JOIN Calendar ON A.Date = Calendar.Date
WHERE (((Calendar.Week)=[forms]![selection]![week]))
GROUP BY Namelist.Name;
Can I use a variable (in place of A in the SQL) and a For – Next loop so that after the SQL has appended the required records from table A into table All Teams it then loops and appends the same records from table B then table C etc. If this is possible could somebody please show me how to do it.
Many Thanks
St
I run the SQL shown below from a form button using DoCmd.RunSql without any trouble. Table A is a yearly rota for team A. I also have table B for team B, table C for team C etc.
INSERT INTO [All Teams] ( Name, [Tot Hrs] )
SELECT Namelist.Name, Sum(A.[Tot Hrs]) AS [SumOfTot Hrs]
FROM (A INNER JOIN Namelist ON A.Team = Namelist.Team) INNER JOIN Calendar ON A.Date = Calendar.Date
WHERE (((Calendar.Week)=[forms]![selection]![week]))
GROUP BY Namelist.Name;
Can I use a variable (in place of A in the SQL) and a For – Next loop so that after the SQL has appended the required records from table A into table All Teams it then loops and appends the same records from table B then table C etc. If this is possible could somebody please show me how to do it.
Many Thanks
St