我收到一条错误消息,提示无法识别等号。我总是在 Access 中测试我的代码以确保它能够正常工作。有谁知道为什么会这样?
代码:
SELECT SUM(
IIf(TransactionType = 'Cash',
TotalPrice, 0)
) AS TotalCash,
SUM(
IIf(TransactionType = 'Credit',
TotalPrice, 0)
) AS TotalCredit,
SUM(
IIf(TransactionType = 'Check',
TotalPrice, 0)
) AS TotalCheck,
SUM(
IIf(TransactionType = 'Multiple',
IIf(MultiCash = 0,
0, MultiCash), 0)
) AS MultipleCash,
SUM(
IIf(TransactionType = 'Multiple',
IIf(MultiCredit= 0,
0, MultiCredit), 0)
) AS MultipleCredit,
SUM(
IIf(TransactionType = 'Multiple',
IIf(MultiCheck = 0,
0, MultiCheck), 0)
) AS MultipleCheck
FROM RECEIPT
WHERE ReceiptDate BETWEEN ? AND ?
错误:
Generated SELECT statement.
Error in list of function arguments: '=' not recongized.
Unable to parse query text.
编辑:
让我告诉你我想做什么,而不仅仅是发布代码。这可能是解决此问题的另一个简单方法。所以我想从 vb.net 的报告查看器中提取一份报告,告诉我在特定日期之间使用的投标。
前任。
1/20/2013
Transaction Type Amount
Cash $100.00
Check $300.00
Credit $1,000.00
MultiCash $1,500.00
MultiCheck $1,500.00
MultiCredit $1,500.00
报告查看器中的类似内容。用户将能够选择特定日期。我要从中提取信息的 Access 数据库表如下所示。
RECEIPT
-----------
ReceiptNumber (PK)
ReceiptDate
TotalPrice
TransactionType
MultiCash
MultiCheck
MultiCredit
TotalTax
也许还有其他方法可以做到这一点?
感谢所有的帮助。