'In Microsoft Access how to calculate an average from one table and save the result in another
I am working in Microsoft Access I have two tables Chart_Review and Lab
Blood pressures are entered in the Lab table
Lab_Type Lab_Date Lab_values Study_id
SBP 3/1/2022 150 101
DBP 3/1/2022 100 101
SBP 3/15/2022 160 101
DBP 3/15/2022 105 101
SBP 3/22/2022 145 101
DBP 3/22/2022 95 101
I want to calculate the average SBP and DBP for readings that occur before the chart review date in the chart_review table and store these baseline averages (151.67, 100) in variables (BL_SBP_Mean, BL_DBP_Mean) in the chart_review table triggered by clicking a button on the Chart_Review form.
I can calculate the average, but I have not figured out how to save/store the values
SELECT Avg([lab_values]) AS avgSBP
FROM Labs INNER JOIN Chart_Review ON Labs.Study_ID_FK = Chart_Review.Study_ID_FK
WHERE (((Labs.Labs)="sbp") AND ((Labs.Lab_Date)<[Chart_Review]![Chart_Review_Date]));
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
