Solved

Data Type Mismatch in Criteria Expression

Posted on 2014-03-21
5
16,459 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 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 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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
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…

822 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