expression is too complex to be evaluated

P

Paul James

I built a query that was working fine at first, but then it started giving
the error message ". . . expression is too complex to be evaluated . . . try
simplifying . . . by assigning parts of the expression to variables."

I know the expression isn't typed incorrectly, because, again, it was
working fine for a while. Subsequently it started producing this error
message, even though I didn't make any changes. So it must be a complexity
issue.

If I were in VBA, I'd know how to assign parts of the expression to
variables, but I built this query in the QBE grid, so I don't see that as a
option. Am I missing something?

Can anyone tell me how I can solve this? Here's the SQL code behind the
query in the design grid:

SELECT DISTINCTROW tblInvoice.Paid, tblInvoice.InvoiceID,
tblInvoice.InvoiceNumber,
CCur(NZ(DSum("[Amount]","[tblDetail]","Invoice_ID=" & [InvoiceID]))) AS
Total, tblInvoice.Preparer, tblInvoice.InvoiceDate, tblInvoice.FiscalYear,
tblInvoice.Index, tblInvoice.Void, tblInvoice.Receipt_ID, tblInvoice.Payee
FROM tblInvoice
WHERE
(((tblInvoice.Paid)=IIf([forms]![frmInvoice_AccountingAndProgram]![chkPaidUn
bound]=-1,0,-1) Or
(tblInvoice.Paid)=IIf([forms]![frmInvoice_AccountingAndProgram]![chkPaidUnbo
und]=-1,0,0)) AND
((tblInvoice.InvoiceDate)>=CDate([forms]![frmInvoice_AccountingAndProgram]![
ctl_frmSubFromTo].[form]![from]) And
(tblInvoice.InvoiceDate)<=CDate([forms]![frmInvoice_AccountingAndProgram]![c
tl_frmSubFromTo].[form]![to])));

Thanks in advance,

Paul
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top