Solved

Data Type Mismatch in Criteria Expression

Posted on 2014-03-21
5
16,190 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
5 Comments
 
LVL 119

Assisted Solution

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

i.e.,

' ' AS CUSTNMBR

with

'' AS CUSTNMBR

or

Null AS CUSTNMBR
0
 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
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 65

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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

706 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now