R
Ron
Hi.
I have added Transform/Pivot code to an existing query
which needs to reference a form's textfield. After my
changes, I get an error stating that the "Microsoft Jet db
does not recognize '[Forms]![FormName]![ColumnName] as a
valid field name or expression".
The below WHERE clause has not been altered, and works
well without the addition of Transform/Pivot. Also, hard
coding a date instead of form value, works. Any help would
be appreciated. Thanks.
TRANSFORM SUM([Account_trade].[Trade_amount]) AS
SumOfAmount
SELECT [Trade].[Trade_id], [Trade].[Relationship_type],
[Trade].[Trade_date],
[Trade].[SecurityIdentifier] AS Symbol, [Trade].
[Quantity] AS Qty, [Trade].[settlement_date],
[Trade].[Commision], [Trade].[Price], [Trade].
[NetAmountIncComm], [Trade].[SecurityIdentifierCode],
[Transaction_Type].[TransactionType_desc],
[Product_type].[Product_type], [TradeCurrency].[Currency],
[Broker].[Broker_name], [Commision].
[CommisionType], [Trade].[PostDate], [Trade].
[settlement_date]
FROM Transaction_Type INNER JOIN (
Accounts INNER JOIN (((
Product_type INNER JOIN (
TradeCurrency INNER JOIN (
Commision INNER JOIN Trade
ON [Commision].[Commision_id]=[Trade].
[Commision_id])
ON ([TradeCurrency].[Currency_id]=[Trade].
[Currency_id])
AND ([TradeCurrency].[Currency_id]=[Trade].
[Currency_id])
AND ([TradeCurrency].[Currency_id]=[Trade].
[Currency_id])
AND ([TradeCurrency].[Currency_id]=[Trade].
[Currency_id]))
ON [Product_type].[Product_type_id]=[Trade].
[Product_type_id])
INNER JOIN Account_trade ON [Trade].[Trade_id]
=[Account_trade].[Trade_id])
INNER JOIN Broker ON [Trade].[Broker_id]=
[Broker].[Broker_id])
ON [Accounts].[Account_no]=[Account_trade].
[Account_no])
ON [Transaction_Type].[TransactionType_id]=
[Trade].[TransactionType_id]
WHERE ((([Trade].[PostDate])=[Forms]![LookupTrades]!
[txtPostDate]))
GROUP BY [Trade].[Trade_id], [Trade].[Relationship_type],
[Trade].[Trade_date],
[Trade].[SecurityIdentifier], [Trade].[Quantity],
[Trade].[settlement_date],
[Trade].[Commision], [Trade].[Price], [Trade].
[NetAmountIncComm],
[Trade].[SecurityIdentifierCode],
[Transaction_Type].[TransactionType_desc],
[Product_type].[Product_type], [TradeCurrency].
[Currency],
[Broker].[Broker_name], [Commision].
[CommisionType], [Trade].[PostDate],
[Trade].[settlement_date]
ORDER BY [Accounts].[Account_name]
PIVOT [Accounts].[Account_name];
I have added Transform/Pivot code to an existing query
which needs to reference a form's textfield. After my
changes, I get an error stating that the "Microsoft Jet db
does not recognize '[Forms]![FormName]![ColumnName] as a
valid field name or expression".
The below WHERE clause has not been altered, and works
well without the addition of Transform/Pivot. Also, hard
coding a date instead of form value, works. Any help would
be appreciated. Thanks.
TRANSFORM SUM([Account_trade].[Trade_amount]) AS
SumOfAmount
SELECT [Trade].[Trade_id], [Trade].[Relationship_type],
[Trade].[Trade_date],
[Trade].[SecurityIdentifier] AS Symbol, [Trade].
[Quantity] AS Qty, [Trade].[settlement_date],
[Trade].[Commision], [Trade].[Price], [Trade].
[NetAmountIncComm], [Trade].[SecurityIdentifierCode],
[Transaction_Type].[TransactionType_desc],
[Product_type].[Product_type], [TradeCurrency].[Currency],
[Broker].[Broker_name], [Commision].
[CommisionType], [Trade].[PostDate], [Trade].
[settlement_date]
FROM Transaction_Type INNER JOIN (
Accounts INNER JOIN (((
Product_type INNER JOIN (
TradeCurrency INNER JOIN (
Commision INNER JOIN Trade
ON [Commision].[Commision_id]=[Trade].
[Commision_id])
ON ([TradeCurrency].[Currency_id]=[Trade].
[Currency_id])
AND ([TradeCurrency].[Currency_id]=[Trade].
[Currency_id])
AND ([TradeCurrency].[Currency_id]=[Trade].
[Currency_id])
AND ([TradeCurrency].[Currency_id]=[Trade].
[Currency_id]))
ON [Product_type].[Product_type_id]=[Trade].
[Product_type_id])
INNER JOIN Account_trade ON [Trade].[Trade_id]
=[Account_trade].[Trade_id])
INNER JOIN Broker ON [Trade].[Broker_id]=
[Broker].[Broker_id])
ON [Accounts].[Account_no]=[Account_trade].
[Account_no])
ON [Transaction_Type].[TransactionType_id]=
[Trade].[TransactionType_id]
WHERE ((([Trade].[PostDate])=[Forms]![LookupTrades]!
[txtPostDate]))
GROUP BY [Trade].[Trade_id], [Trade].[Relationship_type],
[Trade].[Trade_date],
[Trade].[SecurityIdentifier], [Trade].[Quantity],
[Trade].[settlement_date],
[Trade].[Commision], [Trade].[Price], [Trade].
[NetAmountIncComm],
[Trade].[SecurityIdentifierCode],
[Transaction_Type].[TransactionType_desc],
[Product_type].[Product_type], [TradeCurrency].
[Currency],
[Broker].[Broker_name], [Commision].
[CommisionType], [Trade].[PostDate],
[Trade].[settlement_date]
ORDER BY [Accounts].[Account_name]
PIVOT [Accounts].[Account_name];