G
Guest
Please Help!! I am tearing my hair out trying to understand how I can use
an sql query in a sub form but using the filter criteria shown on the
current subform. I have tried creating a calculated control and used a
version of the script below.
SELECT
Sum(STUDY_LEAVE_RECS.COUR_ACT_FEE)+Sum([STUDY_LEAVE_RECS].[COUR_ACT_TRAVEL])+Sum([STUDY_LEAVE_RECS].[COUR_ACT_SUBSISTANCE])+Sum([STUDY_LEAVE_RECS].[COUR_ACT_OTHER_EXPEN]) AS SUM
FROM STUDY_LEAVE_RECS
GROUP BY STUDY_LEAVE_RECS.BUDGET_HOLDER_ID
HAVING (((STUDY_LEAVE_RECS.BUDGET_HOLDER_ID)=2));
I tried replacing the filter
(((STUDY_LEAVE_RECS.BUDGET_HOLDER_ID)=2));
with ( STUDY_LEAVE_RECS.BUDGET_HOLDER_ID)=
[study_leave_recs].[Form]![budget_holder_id]"
and also
with (STUDY_LEAVE_RECS.BUDGET_HOLDER_ID)= [me].budget_holder_id]"
This is an example I want to use, but there are other uses if I can figure
it out. I have had some success with dsum but would like to know how to do
it this way as well. Many thanks!
an sql query in a sub form but using the filter criteria shown on the
current subform. I have tried creating a calculated control and used a
version of the script below.
SELECT
Sum(STUDY_LEAVE_RECS.COUR_ACT_FEE)+Sum([STUDY_LEAVE_RECS].[COUR_ACT_TRAVEL])+Sum([STUDY_LEAVE_RECS].[COUR_ACT_SUBSISTANCE])+Sum([STUDY_LEAVE_RECS].[COUR_ACT_OTHER_EXPEN]) AS SUM
FROM STUDY_LEAVE_RECS
GROUP BY STUDY_LEAVE_RECS.BUDGET_HOLDER_ID
HAVING (((STUDY_LEAVE_RECS.BUDGET_HOLDER_ID)=2));
I tried replacing the filter
(((STUDY_LEAVE_RECS.BUDGET_HOLDER_ID)=2));
with ( STUDY_LEAVE_RECS.BUDGET_HOLDER_ID)=
[study_leave_recs].[Form]![budget_holder_id]"
and also
with (STUDY_LEAVE_RECS.BUDGET_HOLDER_ID)= [me].budget_holder_id]"
This is an example I want to use, but there are other uses if I can figure
it out. I have had some success with dsum but would like to know how to do
it this way as well. Many thanks!