Microsoft
Software
Hardware
Network
Question : Expression too complex to be evaluated
Hello,
I am passing values from fields in a form to criteria in a query. When using "*" as the field value for the date field, I receive an error message "Expression too complex to be evaluated".
The original expression was:
([tblPressStatement].[Pres
sStatement
Date])>[Fo
rms]![frmR
eportBuild
er]![Press
StatementD
ateGreater
Than] And ([tblPressStatement].[Pres
sStatement
Date])<[Fo
rms]![frmR
eportBuild
er]![Press
StatementD
ateLessTha
n])
I determined the when a wildcard is passed as critiera, I get the error (in other words if dates are passed in both fields all is well). So, I tried the following expression with same error message.
Thanks for your help,
Dusty
IIf([Forms]![frmReportBuil
der]![Pres
sStatement
DateGreate
rThan]="*"
And [Forms]![frmReportBuilder]
![PressSta
tementDate
LessThan]=
"*",Like "*",IIf([Forms]![frmReport
Builder]![
PressState
mentDateGr
eaterThan]
="*",IIf([
Forms]![fr
mReportBui
lder]![Pre
ssStatemen
tDateLessT
han]="*",(
[tblPressS
tatement].
[PressStat
ementDate]
)>[Forms]!
[frmReport
Builder]![
PressState
mentDateGr
eaterThan]
,([tblPres
sStatement
].[PressSt
atementDat
e])>[Forms
]![frmRepo
rtBuilder]
![PressSta
tementDate
GreaterTha
n] And ([tblPressStatement].[Pres
sStatement
Date])<[Fo
rms]![frmR
eportBuild
er]![Press
StatementD
ateLessTha
n])))
Answer : Expression too complex to be evaluated
You can't use wildcards for dates.
If you want an option to 'select all dates' then you have to test explicitly for the value you are using to denote that.
In many cases the user would just leave the date field empty because you cannot use invalid dates in a field that is supposed to be date field.
So you do something like....
where (tbl.datefield>forms!formn
ame!startd
ate or isnull(forms!formname!star
tdate)) and .....
Random Solutions
Is there a recycling bin in Windows 7?
CLR Stored Procedure
printing a file given the path in windows API
Basic steps for a Zip code search ASP.NET VB, MS SQL 2008
Calendar question
Pass Web Page as Parameter to Class in App_Code Folder
video card driver
How to restrict on categories with recurrent items using VBA in access
active directory, W2k8 R2 DC, Kerberos failures, Event ID: 3, 4771, 4769, 4768, 4776, 4625 source: Microsoft Windows security
Access attaching a file as xls when it should be rtf