I have several queries that populate a Modern Chart dataset. Each of these queries use a common subform's start and end date as parameters. They are of the form:
PARAMETERS [Forms]![formName]![subfrmFilters]![txtStartDate] DateTime, [Forms]![formName]![subfrmFilters]![txtEndDate] DateTime;
SELECT DSum("columnName","StockTrades","TradeDate BETWEEN Forms![formName]!subfrmFilters!txtStartDate AND Forms![formName]!subfrmFilters!txtEndDate AND TradeDate <= #" & TradeDate & "#")) AS TradeDate
FROM StockTrades
WHERE TradeDate Between Forms!formName!subfrmFilters!txtStartDate And Forms!formName!subfrmFilters!txtEndDate;
In the above, formName is the name of the form the query is called from. These queries populate a Modern Chart in the Form.
This works great but the Parameters as shows requires one query per form because it is specific to the particular formName that it's being invoked from.
I'd like to know if it's possible to replace formName with the equivalent of Me.Name from VBA. That is, how can I make these queries detect the form they're invoked from, rather than hard-code each of query per form?
It would simplify the queries and allow me to use them and possibly combine them in multiple charts. For example, I could create one query for Trade Profitability, another for Trade Risk, and so on. But, as it stands, each form/chart requires a custom query.
Thanks!
Eric