F
Frank
Hi,
Is it possible to return a value from a SELECT query "field" to:
1) a form control -- or
2) a table
I have a query I created in the SQL editor that returns a PASS/FAIL value in
a Result field. I would like to pass this Result from the 30 queries/tests
I'm doing to a main form, which displays names for each of the available
queries/reports. If there is a FAIL anywhere in the query Result field then
that test fails (see below). The test names/records on the form are txtboxes
that feed from a table named ReportNames.
Is the only way to get the result is to create separate update queries for
for each test, or is there a way to pass values from that Result field in the
SELECT query.
Below--the very last select field is the one I would like to pass to a label
or update in the table ReportNames. Thanks for any suggestions or help.
Investment percentage test
Investment Amount Portfolio % Result
USCPA $6,085.00 69.18% PASS
MMF $2,060.00 23.42% PASS
TRV $651.00 7.40% FAIL <--The main form would then
show FAIL for this particular Test:
Investment percentage Test FAIL
SELECT
IIf(([SP Rating ]="A-1+" Or [SP Rating]="A-1")
And [MDY Rating]="P-1",
"A-1 / P-1",
"A-2 / P-2") AS [Investment Rating],
[Asset and SLN Data].[Counterparty ],
Sum([Asset and SLN Data].[Orig Notional]) AS [Investment Notional],
IIf([Investment Rating]="A-1 / P-1",200,75) AS [Limit ($m)],
Sum([Orig Notional ]/DSum("[Orig Notional]","Asset and SLN Data","[Trade
TypeID ] = 'USCPA'")) AS [Portfolio %],
IIf([Investment Rating]="A-1 / P-1" And [Investment
Notional]<=200000000,"PASS",IIf([Investment Rating]="A-2 / P-2" And
[Investment Notional]<75000000,"PASS","FAIL")) AS Result
FROM
[Asset and SLN Data]
WHERE
((([Asset and SLN Data].[Trade TypeID ])="uscpa"))
GROUP BY
IIf(([SP Rating ]="A-1+" Or [SP Rating]="A-1") And [MDY Rating]="P-1","A-1 /
P-1","A-2 / P-2"),
[Asset and SLN Data].[Counterparty ],
IIf([SP Rating]="A-1+" Or [SP Rating]="A-1",1,2),
IIf([MDY Rating]="P-1",1,2)
ORDER BY
IIf(([SP Rating ]="A-1+" Or [SP Rating]="A-1") And [MDY Rating]="P-1","A-1 /
P-1","A-2 / P-2");
Is it possible to return a value from a SELECT query "field" to:
1) a form control -- or
2) a table
I have a query I created in the SQL editor that returns a PASS/FAIL value in
a Result field. I would like to pass this Result from the 30 queries/tests
I'm doing to a main form, which displays names for each of the available
queries/reports. If there is a FAIL anywhere in the query Result field then
that test fails (see below). The test names/records on the form are txtboxes
that feed from a table named ReportNames.
Is the only way to get the result is to create separate update queries for
for each test, or is there a way to pass values from that Result field in the
SELECT query.
Below--the very last select field is the one I would like to pass to a label
or update in the table ReportNames. Thanks for any suggestions or help.
Investment percentage test
Investment Amount Portfolio % Result
USCPA $6,085.00 69.18% PASS
MMF $2,060.00 23.42% PASS
TRV $651.00 7.40% FAIL <--The main form would then
show FAIL for this particular Test:
Investment percentage Test FAIL
SELECT
IIf(([SP Rating ]="A-1+" Or [SP Rating]="A-1")
And [MDY Rating]="P-1",
"A-1 / P-1",
"A-2 / P-2") AS [Investment Rating],
[Asset and SLN Data].[Counterparty ],
Sum([Asset and SLN Data].[Orig Notional]) AS [Investment Notional],
IIf([Investment Rating]="A-1 / P-1",200,75) AS [Limit ($m)],
Sum([Orig Notional ]/DSum("[Orig Notional]","Asset and SLN Data","[Trade
TypeID ] = 'USCPA'")) AS [Portfolio %],
IIf([Investment Rating]="A-1 / P-1" And [Investment
Notional]<=200000000,"PASS",IIf([Investment Rating]="A-2 / P-2" And
[Investment Notional]<75000000,"PASS","FAIL")) AS Result
FROM
[Asset and SLN Data]
WHERE
((([Asset and SLN Data].[Trade TypeID ])="uscpa"))
GROUP BY
IIf(([SP Rating ]="A-1+" Or [SP Rating]="A-1") And [MDY Rating]="P-1","A-1 /
P-1","A-2 / P-2"),
[Asset and SLN Data].[Counterparty ],
IIf([SP Rating]="A-1+" Or [SP Rating]="A-1",1,2),
IIf([MDY Rating]="P-1",1,2)
ORDER BY
IIf(([SP Rating ]="A-1+" Or [SP Rating]="A-1") And [MDY Rating]="P-1","A-1 /
P-1","A-2 / P-2");