Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2013-11-14
5
Medium Priority
?
443 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 1000 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 1000 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

Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

Question has a verified solution.

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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
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 …

721 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