I am using Microsoft Access 2013 with Sharepoint lists and I have two tables:
- students: ID, Full name, Mobile, Start_Date (the date that they start studying at my centre), and some irrelevant fields
=> there are many students with different starting dates
- [Weeks Off]: ID, Reason, From_Date (the date that the centre is temporarily closed), [Number of Weeks] (the number of weeks that the centre is temporariliy closed from that From_Date)
=> in each student' study time, they may have some "weeks off" that are not counted in the total number of weeks that they have studied for.
I am creating a query to calculate the number of weeks that students have studied from their Start_Date
.
SELECT
students.ID,
students.[Full name],
students.Mobile,
students.Start_Date,
Round((Date()-students.[Start_Date])/7,0) -
( SELECT SUM(
IIF( [Weeks Off].[From Date]> students.[Start_Date] and [Weeks Off].[From Date]<Date(),
[Weeks Off].[Number of Weeks], 0 )
)
FROM [Weeks Off]
) AS [Studied Weeks],
FROM students;
The problem now is that even though the query successfully displays all students with a column showing their "Studied Weeks", the Recordset is not updatable.
How can I make it updatable again?
From comment:
I changed it into:
(Round( ( Date()- students.Start_Date)/7,0) -
DSum("[Number of Weeks]", "[Weeks Off]",
"[From Date]>= students.Start_Date And [From Date]<= Date()")
) AS [Studied Weeks]
But it says: Microsoft cannot find the name students.Start_Date you entered in the expression. So I'm still stuck here.