simbamfalme
Registered User.
- Local time
- Today, 12:30
- Joined
- May 23, 2012
- Messages
- 12
Hi guys. Im pretty new to using access and am creating a database to store records of the runners and the runs they take part in. I have five tables, three of which are important for this question i have:
Runner
-RunnerID (Primary Key)
-RunnerName
-NoOfRuns
-DOB
-BestTime
Runs
-RunID (primary key)
-LocationID......;this is from a location table
-RunDate
and a final link table which has no primary key but 2 foreign keys
Results
-RunID
-RunnerID
-RunnerTime
I need a way to update Runner.NoofRuns i.e count the number of runs each runner takes part in. I tried using the DCOunt function but it didnt work
then i tried using queries and came up with a select query :
SELECT Runner.RunnerID, Count(Results.RunnerID) AS CountOfRunnerID
FROM Run INNER JOIN (Runner INNER JOIN Results ON Runner.RunnerID = Results.RunnerID) ON Run.RunID = Results.RunID
GROUP BY Runner.RunnerID;
and then tried to use an update query to update NoOfRuns to CountOfRunnerID from the above query, but got this error:
Operation must use an updateable query
on looking this error up, i found a solution was saing the records of the first select query to a temporary table, and then running the update query from to update NoOfruns from the temp. table. i used the following queries:
The make table query:
SELECT Runner.RunnerID, Count(Results.RunnerID) AS CountOfRunnerID INTO tempruncount
FROM Run INNER JOIN (Runner INNER JOIN Results ON Runner.RunnerID = Results.RunnerID) ON Run.RunID = Results.RunID
GROUP BY Runner.RunnerID;
and the update query:
UPDATE (Runner INNER JOIN tempruncount ON Runner.RunnerID = tempruncount.RunnerID) INNER JOIN Results ON Runner.RunnerID = Results.RunnerID SET Runner.NoOfRuns = [tempruncount]![CountOfRunnerID];
And this seems to work.
However, the process of adding a table and updating from there is too long and i dont like the idea of an ectra table. is there another possible way of working around this, maybe using the DCount function, or counting the records from the update query itself, or solving the "Operation must use an updateable query" problem.
Please help me as this is very important and very urgent.
Runner
-RunnerID (Primary Key)
-RunnerName
-NoOfRuns
-DOB
-BestTime
Runs
-RunID (primary key)
-LocationID......;this is from a location table
-RunDate
and a final link table which has no primary key but 2 foreign keys
Results
-RunID
-RunnerID
-RunnerTime
I need a way to update Runner.NoofRuns i.e count the number of runs each runner takes part in. I tried using the DCOunt function but it didnt work
then i tried using queries and came up with a select query :
SELECT Runner.RunnerID, Count(Results.RunnerID) AS CountOfRunnerID
FROM Run INNER JOIN (Runner INNER JOIN Results ON Runner.RunnerID = Results.RunnerID) ON Run.RunID = Results.RunID
GROUP BY Runner.RunnerID;
and then tried to use an update query to update NoOfRuns to CountOfRunnerID from the above query, but got this error:
Operation must use an updateable query
on looking this error up, i found a solution was saing the records of the first select query to a temporary table, and then running the update query from to update NoOfruns from the temp. table. i used the following queries:
The make table query:
SELECT Runner.RunnerID, Count(Results.RunnerID) AS CountOfRunnerID INTO tempruncount
FROM Run INNER JOIN (Runner INNER JOIN Results ON Runner.RunnerID = Results.RunnerID) ON Run.RunID = Results.RunID
GROUP BY Runner.RunnerID;
and the update query:
UPDATE (Runner INNER JOIN tempruncount ON Runner.RunnerID = tempruncount.RunnerID) INNER JOIN Results ON Runner.RunnerID = Results.RunnerID SET Runner.NoOfRuns = [tempruncount]![CountOfRunnerID];
And this seems to work.
However, the process of adding a table and updating from there is too long and i dont like the idea of an ectra table. is there another possible way of working around this, maybe using the DCount function, or counting the records from the update query itself, or solving the "Operation must use an updateable query" problem.
Please help me as this is very important and very urgent.