473,320 Members | 1,572 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

year() in a where string

1,271 Expert 1GB
This one's got me talking to myself, and not in a good way.

Why does this query
Expand|Select|Wrap|Line Numbers
  1. SELECT DISTINCT Patients_eMD_qry.[eMD Patient], Year([born]) AS BirthYr
  2. FROM Patients_eMD_qry
  3. WHERE (((Year([born]))=Year([born])))
fail on error "Data Type Mismatch in Criteria Expression"?!!
Of course I don't really want to test Year(born) against itself. I was testing against the year of a text box entry and various tests led me to this. This just looked like the best way to highlight the absurdity of the situation.

Got similar error result with datediff(). If I remove the criteria, I see the birth years range from 1900 to 1998. I can even test for a literal year, i.e. 1928, and it still fails.

Using Access 2007, all service packs installed.

Jim
Feb 11 '15 #1
1 910
Rabbit
12,516 Expert Mod 8TB
Is born a date data type? If it's a string, convert it first using cdate()
Feb 11 '15 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: John Hunter | last post by:
>>> from datetime import date >>> dt = date(1005,1,1) >>> print dt.strftime('%Y') Traceback (most recent call last): File "<stdin>", line 1, in ? ValueError: year=1005 is before 1900; the...
6
by: Syl | last post by:
I've been through the php.net docs, and this newsgroup - and all seems to be configured properly, but this statement is still not working: switch ($level) { case 1: $nextyear =...
9
by: ritchie | last post by:
Hello, Just wondering if anyone could help me with a basic C string-parsing question. I have an Integer date ie: YYYYMMDD. I can convert it into a string but I want to break it down to: Int...
6
by: crovax75 | last post by:
LS, I've a problem to get the year, month and day from the following string: "20051027" -- #include <stdio.h> #include <string.h>
14
by: Lyle Fairfield | last post by:
Year Numbers A recent post prompts me to point out a capability of JET 4.0, to set the seed and increment of identity columns. (This is not a solution for that post.) I create a Table named...
33
by: Jordan Tiona | last post by:
How can I make one of these? I'm trying to get my program to store a string into a variable, but it only stores one line. -- "No eye has seen, no ear has heard, no mind can conceive what God...
7
by: Grey Alien | last post by:
Does *ANYONE* in here know how I may parse the various date/time 'elements' from a string?. The input string has the ff format: 'YYYY-MM-DD HH:MM:SS AM'
11
by: Dan Holmes | last post by:
I have a need to reverse a date to show as a "date code". For example today, 090507 would be coded as 905070 (reversing the parts of the date. This is what i have but there has to be a better...
1
by: medic3212 | last post by:
Greatings, I am a vbs newbie, about two months of class. I am working on a dispatching program which uses an incrementing call number. The call number is made up of two separate parts, the...
2
by: donthomasino | last post by:
i get error c2886( when i use using std::cout; using std::string;) and when i change to (using namespace std; using namespace std;) i got error c2059 #include <iostream> #include <string>...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.