Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

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…
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

876 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