Hello,
Trying to get better i have much trouble providing code for my DB..
and i would like help on insert into fired from command button "cmdAllAthletes" on the subform of my form Fr_CourseSessions
I would like to fill rows to Tbl_CourseAttendances for athletes registered in tennis course sessions filled from the above form "Fr_CourseSessions"
My code is:
same sql (which is working from query) is:
but it has errors in from clause
Also i would like my subform to show athletes registered in the specific session when chosen from "Fr_CourseSessions" and maybe a more efficient
way to automate the process ( seeing the subform takes space in my form) maybe after inserting a new session then attendance rows are filled
(maybe Form "Fr_CourseSessions" AfterUpdate? Dont know what it could be better!?
I attach my DB
Trying to get better i have much trouble providing code for my DB..
and i would like help on insert into fired from command button "cmdAllAthletes" on the subform of my form Fr_CourseSessions
I would like to fill rows to Tbl_CourseAttendances for athletes registered in tennis course sessions filled from the above form "Fr_CourseSessions"
My code is:
Code:
Private Sub cmdAllAthletes_Click()
Dim strSQL As String
strSQL = "INSERT INTO Tbl_CourseAttendances " & _
"(courseID, CourseDate, athleteID) " & _
"SELECT athleteID, " & Parent.[CourseID] & ", #" & _
Format(Parent.[CourseDate], "yyyy-mm-dd ") & _
"# FROM Tbl_CourseSessions INNER JOIN Tbl_CourseAthletes WHERE Tbl_CourseSessions.courseID = " & Parent.[CourseID]
CurrentDb.Execute strSQL
same sql (which is working from query) is:
Code:
INSERT INTO Tbl_CourseAttendances ( courseID, CourseDate, athleteID )
SELECT Tbl_CourseSessions.courseID, Tbl_CourseSessions.CourseDate, Tbl_CourseAthletes.athleteID
FROM Tbl_CourseSessions INNER JOIN Tbl_CourseAthletes ON Tbl_CourseSessions.courseID = Tbl_CourseAthletes.courseID;
but it has errors in from clause
Also i would like my subform to show athletes registered in the specific session when chosen from "Fr_CourseSessions" and maybe a more efficient
way to automate the process ( seeing the subform takes space in my form) maybe after inserting a new session then attendance rows are filled
(maybe Form "Fr_CourseSessions" AfterUpdate? Dont know what it could be better!?
I attach my DB