A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Query Should run but Data Type Mismatch error



 
 
Thread Tools Display Modes
  #1  
Old September 9th, 2004, 09:27 AM
news.paradise.net.nz
external usenet poster
 
Posts: n/a
Default Query Should run but Data Type Mismatch error

I have been developing access databases for over 5 years.
I have a large database and I have struck this problem with it before
but can find nothing in help or online. Access 2000

I have a query that will run fine without any criteria but as soon as I
add any criteria it gives a "Data type mismatch" error.
As soon as I remove any criteria it runs perfectly.
I know this query is based on another query but I have other processes
based on this query with no issues.
I tried saving this query and basing another query on this one and got
the same error.
I have tried passing back variables from functions and still get a "Data
type mismatch"

eg: the following will run okay with the field b_cg_1 calculating
corectly as a boolean (-1,0)

SELECT qry_010_project_calc_base_forcast.*, CBool(nz([repl_cg_1],21)20-
[element_base_life]) AS b_cg_1
FROM qry_010_project_calc_base_forcast

If I add the criteria below I get an error
WHERE (CBool(nz([repl_cg_1],21)20-[element_base_life]))=True

When I run the following type of thing I get an error (typing from
memory)
SELECT qry_010_project_calc_base_forcast.*
FROM qry_010_project_calc_base_forcast
WHERE repl_cg_1 is not null

As an aside this is the database I could not set a breakpoint in VBA to
debug and had to import the entire contents into a new database to
eliminate this error and get breakpoints working again.

I hope someone has struck this issue before and has a fix as I look like
a bit of a noddy saying to my client that I believe I have discovered
and Access error.

TIA, Gavin.
  #2  
Old September 9th, 2004, 01:19 PM
Jeff Boyce
external usenet poster
 
Posts: n/a
Default

Any chance the underlying database has one/more tables with a lookup data
type defined? This could be why the criterion entered doesn't match the
data type of the underlying field.

--
Good luck

Jeff Boyce
Access MVP

 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Word 2000/2002 - Proper Mail Merge steps for ODBC? Tony_VBACoder Mailmerge 7 September 2nd, 2004 09:21 PM
data type mismatch in criteria expression when no criteria specified JR Running & Setting Up Queries 1 July 27th, 2004 03:47 AM
Is there a way around a Type Mismatch Error? Kristen Running & Setting Up Queries 4 June 24th, 2004 01:11 AM
Data type mismatch in criteria expression Emma Using Forms 2 June 24th, 2004 12:32 AM


All times are GMT +1. The time now is 04:54 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.