Passing a parameter through VBA

You can save the date and region into public variables and having the queries reading them using a function

If you dont like public variables you can save them into a table and use this table in your queries
 
...

The expression:

is in query: "f-3 Cumulative WARF All Portfolio"

I don't have to enter any amount as it is calculated from the query. But I still have to click OK.
In the query change the "Group By" to "Expression" in the "Expr1: [SumOfWARFamount]/[SumOfParAmountTraded]".
The SQL-string:
SELECT TOP 5 [Portfolio list].ReportNameAbr, MainData.AsOfDate, Sum(MainData.WARFamount) AS SumOfWARFamount, Sum(MainData.ParAmountTraded) AS SumOfParAmountTraded, [SumOfWARFamount]/[SumOfParAmountTraded] AS Expr1
FROM MainData INNER JOIN [Portfolio list] ON MainData.Portfolio_Name = [Portfolio list].SystemName
GROUP BY [Portfolio list].ReportNameAbr, MainData.AsOfDate
ORDER BY MainData.AsOfDate;
The other is answered by "Smig".
 
You can save the date and region into public variables and having the queries reading them using a function

If you dont like public variables you can save them into a table and use this table in your queries

Can you walk me through how to do this?

I have written code in Visual Basic for Excel but Access is still new to me.

Thanks
 

Users who are viewing this thread

Back
Top Bottom