DeveloperBarn Forums

DeveloperBarn

Programming & IT forum

Data Type Mismatch in Criteria Expression

This is a discussion on Data Type Mismatch in Criteria Expression within the Microsoft Access forums, part of the Databases category; Ok guys, this has me stumped. The title is the message I get for some of the queries I have ...

Go Back   DeveloperBarn Forums > Databases > Microsoft Access

  #1  
Old April 9th, 2008, 03:21 PM
Barnie
 
Join Date: Apr 2008
Real name: Alan
Location: Lake County, IL
Posts: 19
Rep Power: 2
alansidman is on a distinguished road
Default Data Type Mismatch in Criteria Expression

Ok guys, this has me stumped. The title is the message I get for some of the queries I have written. I have a table with some dates and names in it. In particular I want to know all the applications that have been executed in the prior month.
I have an expression:
Expr1: IIf(Format([ndaDteEx],"mm")<10,Mid("00" & Format([ndaDteEx],"mm"),3) & Format([ndaDteEx],"yyyy"),Format([ndaDteEx],"mm") & Format([ndaDteEx],"yyyy"))
In the criteria:
IIf(Format(Date(),"mm")<10,Mid("00" & Format(Date(),"mm")-1,2) & Format(Date(),"yyyy"),Format(Date(),"mm")-1 & Format(Date(),"yyyy"))
There are several tables and I run a similar query against each one with only the field name changed appropriately. Some of the queries appear to run fine, and others give me the error message.

Your thoughts???
Alan
  #2  
Old April 9th, 2008, 04:33 PM
Barnie
 
Join Date: Apr 2008
Real name: Alan
Location: Lake County, IL
Posts: 19
Rep Power: 2
alansidman is on a distinguished road
Default

I found the answer. In setting up the db, I had left some empty fields that were actually populated with blanks ie. "" in some date fields. This resulted in the error message. Once the fields and records were deleted, the queries ran as designed.
Alan

Comments on this post
AOG123 agrees: Thanks for posting the solution
sbenj69 agrees: you can also use an nz function if needed
jmurrayhead agrees: thanks for posting your solution
Closed Thread

  DeveloperBarn Forums > Databases > Microsoft Access

Bookmarks

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

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


Similar Threads

Thread Thread Starter Forum Replies Last Post
[Error] Type mismatch: HTMLEncode Rebelle ASP Development 20 March 28th, 2008 09:30 AM


All times are GMT -4. The time now is 01:51 AM.


Copyright ©2008-2010, DeveloperBarn

Content Relevant URLs by vBSEO 3.3.2