PC Review


Reply
Thread Tools Rate Thread

Access 2003-Criteria Expression

 
 
=?Utf-8?B?Y24=?=
Guest
Posts: n/a
 
      19th May 2006
I have a data base that was created in Access 97. I am currently using the
database in Access 2003 and getting an error on a query expression that
worked in 97. The parameter is: [Type in License Year (2003/2004):] . This
is set as a text box. When the user enters information 2003/2004, an error
message appears with "The expression is typed incorrectly, or it is too
complex to be evaluated." If I enter the data directly in the query in
Design View and Run the message is "Data type mismatch in criteria
expression." All this works in Access 97. What has changed in Access 2003?
What do I change to get this to work in Access 2003?

Thanks for your help.
CN
 
Reply With Quote
 
 
 
 
Allen Browne
Guest
Posts: n/a
 
      19th May 2006
JET 4 (the query engine in Access 2000 and later) is less capable of
determining the data type of parameters and calculated expressions than the
older version of JET was.

To avoid the problem, explicitly declare the parameter so Access understands
the data type. For example, if this parameter is in the Criteria row under a
field of type Number (size Long Integer), choose Parameters on the Query
menu, and enter this row into the dialog:
[Type in License Year (2003/2004):] Long

If the query is for criteria of a calculated fields, typecast the
calculation. Details in:
Calculated fields misinterpreted
at:
http://allenbrowne.com/ser-45.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"cn" <(E-Mail Removed)> wrote in message
news:76750841-F8FC-488C-9CEC-(E-Mail Removed)...
>I have a data base that was created in Access 97. I am currently using the
> database in Access 2003 and getting an error on a query expression that
> worked in 97. The parameter is: [Type in License Year (2003/2004):] .
> This
> is set as a text box. When the user enters information 2003/2004, an
> error
> message appears with "The expression is typed incorrectly, or it is too
> complex to be evaluated." If I enter the data directly in the query in
> Design View and Run the message is "Data type mismatch in criteria
> expression." All this works in Access 97. What has changed in Access
> 2003?
> What do I change to get this to work in Access 2003?
>
> Thanks for your help.
> CN



 
Reply With Quote
 
=?Utf-8?B?Y24=?=
Guest
Posts: n/a
 
      19th May 2006
I have the Parameter declared as Text under the Query - Parameters. That was
done in the original database. I tried removing the Query-Parameter setting
and still the erros.

CN

"Allen Browne" wrote:

> JET 4 (the query engine in Access 2000 and later) is less capable of
> determining the data type of parameters and calculated expressions than the
> older version of JET was.
>
> To avoid the problem, explicitly declare the parameter so Access understands
> the data type. For example, if this parameter is in the Criteria row under a
> field of type Number (size Long Integer), choose Parameters on the Query
> menu, and enter this row into the dialog:
> [Type in License Year (2003/2004):] Long
>
> If the query is for criteria of a calculated fields, typecast the
> calculation. Details in:
> Calculated fields misinterpreted
> at:
> http://allenbrowne.com/ser-45.html
>
> --
> Allen Browne - Microsoft MVP. Perth, Western Australia.
> Tips for Access users - http://allenbrowne.com/tips.html
> Reply to group, rather than allenbrowne at mvps dot org.
>
> "cn" <(E-Mail Removed)> wrote in message
> news:76750841-F8FC-488C-9CEC-(E-Mail Removed)...
> >I have a data base that was created in Access 97. I am currently using the
> > database in Access 2003 and getting an error on a query expression that
> > worked in 97. The parameter is: [Type in License Year (2003/2004):] .
> > This
> > is set as a text box. When the user enters information 2003/2004, an
> > error
> > message appears with "The expression is typed incorrectly, or it is too
> > complex to be evaluated." If I enter the data directly in the query in
> > Design View and Run the message is "Data type mismatch in criteria
> > expression." All this works in Access 97. What has changed in Access
> > 2003?
> > What do I change to get this to work in Access 2003?
> >
> > Thanks for your help.
> > CN

>
>
>

 
Reply With Quote
 
Allen Browne
Guest
Posts: n/a
 
      20th May 2006
Firstly, temporarily remove the parameter from the query, and see if it
still errors. You need to know whether this is the cause or if it is
something else.

If that clears the problem, tell us about the field you are placing this
parameter under. It is a calculated field, or a table field? If it is a
table field, open the table in design view and see what Data type it is. If
it is a calculated field, typecast as in the previous link.

If the problem remains, switch the query to SQL View (View menu), and paste
the query statement here.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"cn" <(E-Mail Removed)> wrote in message
news:484C6DEA-9CF0-4E04-9F59-(E-Mail Removed)...
>I have the Parameter declared as Text under the Query - Parameters. That
>was
> done in the original database. I tried removing the Query-Parameter
> setting
> and still the erros.
>
> CN
>
> "Allen Browne" wrote:
>
>> JET 4 (the query engine in Access 2000 and later) is less capable of
>> determining the data type of parameters and calculated expressions than
>> the
>> older version of JET was.
>>
>> To avoid the problem, explicitly declare the parameter so Access
>> understands
>> the data type. For example, if this parameter is in the Criteria row
>> under a
>> field of type Number (size Long Integer), choose Parameters on the Query
>> menu, and enter this row into the dialog:
>> [Type in License Year (2003/2004):] Long
>>
>> If the query is for criteria of a calculated fields, typecast the
>> calculation. Details in:
>> Calculated fields misinterpreted
>> at:
>> http://allenbrowne.com/ser-45.html
>>
>> "cn" <(E-Mail Removed)> wrote in message
>> news:76750841-F8FC-488C-9CEC-(E-Mail Removed)...
>> >I have a data base that was created in Access 97. I am currently using
>> >the
>> > database in Access 2003 and getting an error on a query expression that
>> > worked in 97. The parameter is: [Type in License Year (2003/2004):] .
>> > This
>> > is set as a text box. When the user enters information 2003/2004, an
>> > error
>> > message appears with "The expression is typed incorrectly, or it is too
>> > complex to be evaluated." If I enter the data directly in the query in
>> > Design View and Run the message is "Data type mismatch in criteria
>> > expression." All this works in Access 97. What has changed in Access
>> > 2003?
>> > What do I change to get this to work in Access 2003?



 
Reply With Quote
 
=?Utf-8?B?Y24=?=
Guest
Posts: n/a
 
      23rd May 2006
Thank you for the help. Cleared parameter and expression. Saved the query
and re-opened and replaced parameter and expression. It now works.
CN

"Allen Browne" wrote:

> Firstly, temporarily remove the parameter from the query, and see if it
> still errors. You need to know whether this is the cause or if it is
> something else.
>
> If that clears the problem, tell us about the field you are placing this
> parameter under. It is a calculated field, or a table field? If it is a
> table field, open the table in design view and see what Data type it is. If
> it is a calculated field, typecast as in the previous link.
>
> If the problem remains, switch the query to SQL View (View menu), and paste
> the query statement here.
>
> --
> Allen Browne - Microsoft MVP. Perth, Western Australia.
> Tips for Access users - http://allenbrowne.com/tips.html
> Reply to group, rather than allenbrowne at mvps dot org.
>
> "cn" <(E-Mail Removed)> wrote in message
> news:484C6DEA-9CF0-4E04-9F59-(E-Mail Removed)...
> >I have the Parameter declared as Text under the Query - Parameters. That
> >was
> > done in the original database. I tried removing the Query-Parameter
> > setting
> > and still the erros.
> >
> > CN
> >
> > "Allen Browne" wrote:
> >
> >> JET 4 (the query engine in Access 2000 and later) is less capable of
> >> determining the data type of parameters and calculated expressions than
> >> the
> >> older version of JET was.
> >>
> >> To avoid the problem, explicitly declare the parameter so Access
> >> understands
> >> the data type. For example, if this parameter is in the Criteria row
> >> under a
> >> field of type Number (size Long Integer), choose Parameters on the Query
> >> menu, and enter this row into the dialog:
> >> [Type in License Year (2003/2004):] Long
> >>
> >> If the query is for criteria of a calculated fields, typecast the
> >> calculation. Details in:
> >> Calculated fields misinterpreted
> >> at:
> >> http://allenbrowne.com/ser-45.html
> >>
> >> "cn" <(E-Mail Removed)> wrote in message
> >> news:76750841-F8FC-488C-9CEC-(E-Mail Removed)...
> >> >I have a data base that was created in Access 97. I am currently using
> >> >the
> >> > database in Access 2003 and getting an error on a query expression that
> >> > worked in 97. The parameter is: [Type in License Year (2003/2004):] .
> >> > This
> >> > is set as a text box. When the user enters information 2003/2004, an
> >> > error
> >> > message appears with "The expression is typed incorrectly, or it is too
> >> > complex to be evaluated." If I enter the data directly in the query in
> >> > Design View and Run the message is "Data type mismatch in criteria
> >> > expression." All this works in Access 97. What has changed in Access
> >> > 2003?
> >> > What do I change to get this to work in Access 2003?

>
>
>

 
Reply With Quote
 
=?Utf-8?B?Y24=?=
Guest
Posts: n/a
 
      23rd May 2006
Thank you for the help. Cleared parameter and expression. Saved the query
and re-opened and replaced parameter and expression. It now works.
CN

"Allen Browne" wrote:

> Firstly, temporarily remove the parameter from the query, and see if it
> still errors. You need to know whether this is the cause or if it is
> something else.
>
> If that clears the problem, tell us about the field you are placing this
> parameter under. It is a calculated field, or a table field? If it is a
> table field, open the table in design view and see what Data type it is. If
> it is a calculated field, typecast as in the previous link.
>
> If the problem remains, switch the query to SQL View (View menu), and paste
> the query statement here.
>
> --
> Allen Browne - Microsoft MVP. Perth, Western Australia.
> Tips for Access users - http://allenbrowne.com/tips.html
> Reply to group, rather than allenbrowne at mvps dot org.
>
> "cn" <(E-Mail Removed)> wrote in message
> news:484C6DEA-9CF0-4E04-9F59-(E-Mail Removed)...
> >I have the Parameter declared as Text under the Query - Parameters. That
> >was
> > done in the original database. I tried removing the Query-Parameter
> > setting
> > and still the erros.
> >
> > CN
> >
> > "Allen Browne" wrote:
> >
> >> JET 4 (the query engine in Access 2000 and later) is less capable of
> >> determining the data type of parameters and calculated expressions than
> >> the
> >> older version of JET was.
> >>
> >> To avoid the problem, explicitly declare the parameter so Access
> >> understands
> >> the data type. For example, if this parameter is in the Criteria row
> >> under a
> >> field of type Number (size Long Integer), choose Parameters on the Query
> >> menu, and enter this row into the dialog:
> >> [Type in License Year (2003/2004):] Long
> >>
> >> If the query is for criteria of a calculated fields, typecast the
> >> calculation. Details in:
> >> Calculated fields misinterpreted
> >> at:
> >> http://allenbrowne.com/ser-45.html
> >>
> >> "cn" <(E-Mail Removed)> wrote in message
> >> news:76750841-F8FC-488C-9CEC-(E-Mail Removed)...
> >> >I have a data base that was created in Access 97. I am currently using
> >> >the
> >> > database in Access 2003 and getting an error on a query expression that
> >> > worked in 97. The parameter is: [Type in License Year (2003/2004):] .
> >> > This
> >> > is set as a text box. When the user enters information 2003/2004, an
> >> > error
> >> > message appears with "The expression is typed incorrectly, or it is too
> >> > complex to be evaluated." If I enter the data directly in the query in
> >> > Design View and Run the message is "Data type mismatch in criteria
> >> > expression." All this works in Access 97. What has changed in Access
> >> > 2003?
> >> > What do I change to get this to work in Access 2003?

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
selecting null with an iif expression in criteria access 2k3 Leslie Porter OHV Microsoft Access 13 8th Oct 2008 07:52 PM
!VB.NET/Access: OleDbException (Data type mismatch in criteria expression) Mike Wilson Microsoft ADO .NET 0 16th Jul 2007 08:35 PM
Query expression criteria- Access can't recognize column as dates =?Utf-8?B?TGlzYUI=?= Microsoft Access Queries 3 2nd Aug 2005 01:41 AM
Re: Data type mismatch in criteria expression in MS-ACCESS Severin Microsoft ADO .NET 0 6th Oct 2003 09:45 PM
Re: Data type mismatch in criteria expression in MS-ACCESS Chance Hopkins Microsoft ADO .NET 0 6th Oct 2003 09:36 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:37 PM.