user input min/max error

  • Thread starter Thread starter JOHN
  • Start date Start date
J

JOHN

I post a problem earlier this morning... i pasted the
problem and the reply at bottom of this posting

when i tried to enter this expression "Days Pack Out: CInt
(Date() - [Pack Out])" in the parameters i got this error
message "The Expression is typed incorretly, or it is too
complex to be evaluated. For example, a numeric
expression may contain to many coplicated elements. Try
simplifying by assgning parts of the expression to
variables." in the querie i have field set to "Days Pack
Out: Date()-[Pack Out]". i have criteria set to "Between
[Enter minimum days pack out] And [Enter maximim days pack
out]". and sort set to " ascending

then i tried not puting any parameters in and setting
field to "Days Pack Out: CInt(Date() - [Pack Out])"

so then i tried to set the criteria to "Between CInt
([Enter minimum days pack out] And [Enter maximim days
pack out])"
They both resulted in the same error message...did i enter
the parameter in the wrong spot possibly? or set it to the
wrong data type?
===========================================================
===========================================================
It looks like the query is considering your Days Pack Out
and/or the two
parameters as text. You can force it to do a numeric
compare by explicitly
declaring the parameters as Integer (choose Parameters
from the Query menu)
and by forcing a convert of Days Pack Out:

Days Pack Out: CInt(Date() - [Pack Out])

--
John Viescas, author
"Microsoft Office Access 2003 Inside Out"
"Running Microsoft Access 2000"
"SQL Queries for Mere Mortals"
http://www.viescas.com/
(Microsoft Access MVP since 1993)
 
Is [Pack Out] a field in one of your tables or a parameter? If it's a
parameter, then you need to declare it. Declare only the parameter, not the
expression. If not, then you need do nothing with [Pack Out]. It seems
pretty clear that [Enter minimum days pack out] and [Enter maximum days pack
out] are parameters. Leave your original criteria alone.

--
John Viescas, author
"Microsoft Office Access 2003 Inside Out"
"Running Microsoft Access 2000"
"SQL Queries for Mere Mortals"
http://www.viescas.com/
(Microsoft Access MVP since 1993)
JOHN said:
I post a problem earlier this morning... i pasted the
problem and the reply at bottom of this posting

when i tried to enter this expression "Days Pack Out: CInt
(Date() - [Pack Out])" in the parameters i got this error
message "The Expression is typed incorretly, or it is too
complex to be evaluated. For example, a numeric
expression may contain to many coplicated elements. Try
simplifying by assgning parts of the expression to
variables." in the querie i have field set to "Days Pack
Out: Date()-[Pack Out]". i have criteria set to "Between
[Enter minimum days pack out] And [Enter maximim days pack
out]". and sort set to " ascending

then i tried not puting any parameters in and setting
field to "Days Pack Out: CInt(Date() - [Pack Out])"

so then i tried to set the criteria to "Between CInt
([Enter minimum days pack out] And [Enter maximim days
pack out])"
They both resulted in the same error message...did i enter
the parameter in the wrong spot possibly? or set it to the
wrong data type?
===========================================================
===========================================================
It looks like the query is considering your Days Pack Out
and/or the two
parameters as text. You can force it to do a numeric
compare by explicitly
declaring the parameters as Integer (choose Parameters
from the Query menu)
and by forcing a convert of Days Pack Out:

Days Pack Out: CInt(Date() - [Pack Out])

--
John Viescas, author
"Microsoft Office Access 2003 Inside Out"
"Running Microsoft Access 2000"
"SQL Queries for Mere Mortals"
http://www.viescas.com/
(Microsoft Access MVP since 1993)
JOHN said:
MVP,
First off thanks for you great help yeasterday!
today i have a new problem. i have a Querie with a
calsulated colum
"Days Pack Out: Date()-[Pack Out]"
that works great to i added user input to narrow down the
search alittle. so in the Criteria: in design view i
entered
"Between [Enter minimum days pack out] And [Enter maximim
days pack out]"
If the user enters values of 10 as min and 15 as max the
querie will show values of 10-15
THE PROBLEM....the Querie will also show values starting
with numbers from 10-15 suck as values from 100-150.
so what is happening here and how do i fix it?
Thanks in advance for you help.
JOHN
 
Back
Top