Solved

Data Type Mismatch in Criteria Expression

Posted on 2014-03-21
5
17,022 Views
Last Modified: 2014-03-21
Hello,

I am trying to run an append Query in Access 2010 into a SQL Server 2008 R2 table and getting the error "Data Type Mismatch in Criteria Expression".  As a result, the append query won't run. The join field are either CHAR or VARCHAR. These are not native access tables...I am just linking to these tables from Access.

I am attaching the Access generated SQL.

 Any thoughts on this please?

Thank you
Access-Query-SQL.txt
0
Comment
Question by:htamraz1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 120

Assisted Solution

by:Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1) earned 250 total points
ID: 39946623
try replacing ' ' with ''  or Null

i.e.,

' ' AS CUSTNMBR

with

'' AS CUSTNMBR

or

Null AS CUSTNMBR
0
 
LVL 48

Expert Comment

by:Dale Fye
ID: 39946644
all you can really do is go to the source tables and check the data types and dproperties like allow Nulls and allow zero length strings
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 39946699
In order to help you we need the schema (CREATE TABLE) for the following tables:
dbo_SY06000
dbo_Organizations
dbo_PM00200
dbo_Organizations_Ext
0
 
LVL 66

Accepted Solution

by:
Jim Horn earned 250 total points
ID: 39946701
Check the data types..Check EACH data type of both the source table, and the destination table that you're trying to insert records into, to make sure they are the same.

>' ' AS CBANKCD
>' ' AS CURNCYID
CD and ID normally implies a numeric value, and no numeric value will accept a space.
0
 

Author Comment

by:htamraz1
ID: 39946820
I changed ' ' AS to '' AS; however, that alone did not resolve the issue.

I ended up having to removing the following two fields from the query/sql syntax and the append query worked fine. The two fields are:

'1900-01-01 00:00:00.000' AS EFTPrenoteDate, '1900-01-01 00:00:00.000' AS EFTTerminationDate

The database populated a default DATETIME value and having these two fields in query caused the error previously reported.

Your suggestions helped pin down the issue.
0

Featured Post

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

622 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question