Solved

MS ACCESS text date field compared in CRITERIA as NOT this Year

Posted on 2013-11-14
5
434 Views
Last Modified: 2013-11-14
PREVIOUS QUESTION

As a follow on to the above question I need to also check that something is NOT THIS YEAR, I've tried taking the lead from the above question where criteria MONTH(DATE()) allowed for a comparison of this month against the data and looking at something like NOT YEAR(DATE()) but this didn't work.

This bit does provide the year:
SVC_YEAR: Year(Format(Mid([SVC_DATE],5,2) & "/" & Mid([SVC_DATE],7,2) & "/" & Left([SVC_DATE],4),"mm/dd/yyyy"))
0
Comment
Question by:ghettocounselor
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 250 total points
ID: 39648643
in the SVC_YEAR column, place in the criteria row


<>Year(date())
0
 

Author Comment

by:ghettocounselor
ID: 39648653
with this I get "DATA TYPE MISMATCH IN CRITERIA EXPRESSION"

WHERE (((Year(Format(Mid([SVC_DATE],5,2) & "/" & Mid([SVC_DATE],7,2) & "/" & Left([SVC_DATE],4),"mm/dd/yyyy")))<>Year(Date())));
0
 
LVL 21

Assisted Solution

by:Boyd (HiTechCoach) Trimmell, Microsoft Access MVP
Boyd (HiTechCoach) Trimmell, Microsoft Access MVP earned 250 total points
ID: 39648662
You coudl simplify the calculated column (field) to:

SVC_YEAR: Val(Left([SVC_DATE],4)) 

Open in new window

then use the criteria

<>Year(date())

or edit the where clause to include:

Where  Val(Left([SVC_DATE],4)) <>  YEAR(DATE()) ...

Open in new window

0
 
LVL 61

Expert Comment

by:mbizup
ID: 39648665
Try  simplifying it like this (adding the xxxx to the end handles nulls):

SVC_YEAR: Left(SVC_DATE & "xxxx",4)  

And use as criteria (as cap1 suggested):  <> Year(Date())
0
 

Author Closing Comment

by:ghettocounselor
ID: 39648725
Thanks for all the help
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQL Query logic question 14 71
Handle Apostrophes in VBA SQL - Part 2 10 47
Speed up Select Top n... Query 9 36
Button to auto fill form with previous record 3 17
This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

732 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