Go Back   DeveloperBarn Forums > Databases > Microsoft Access

Sponsored Links

Discuss "Data Type Mismatch in Criteria Expression" in the Microsoft Access forum.

Microsoft Access - Microsoft Access is a database for small to medium applications. Learn tips and tricks and best database practices here.


Closed Thread « Previous Thread | Next Thread »  
 
LinkBack Thread Tools Display Modes
  #1  
Old April 9th, 2008, 03:21 PM
Barn Newbie
 
Join Date: Apr 2008
Location: Lake County, IL
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 1
alansidman is an unknown quantity at this point
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
Sponsored Links
  #2  
Old April 9th, 2008, 04:33 PM
Barn Newbie
 
Join Date: Apr 2008
Location: Lake County, IL
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 1
alansidman is an unknown quantity at this point
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
Forum Jump

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 06:45 PM.



Content Relevant URLs by vBSEO 3.2.0