Solved

MS ACCESS text date field compared with datereltoday in query

Posted on 2013-11-14
4
498 Views
Last Modified: 2013-11-14
I have a field SVC_DATE stored as text in this format 20131114
and what I want to do is use a criteria of 'this month' as in current month based on todays date.

I am able to get the month out of the thing with this
SVC_MONTH: Month(Format(Mid([SVC_DATE],5,2) & "/" & Mid([SVC_DATE],7,2) & "/" & Left([SVC_DATE],4),"mm/dd/yyyy"))

And I'm having trouble with setting up the criteria of 'this month'.

I was thinking something like "Like Month(DATERELTODAY(0))" but get a data type mismatch

Thanks,
Mark
0
Comment
Question by:ghettocounselor
  • 2
4 Comments
 
LVL 61

Accepted Solution

by:
mbizup earned 500 total points
ID: 39648581
This month would simply be:

Month(Date())

Is that what you are looking for?
0
 
LVL 61

Expert Comment

by:mbizup
ID: 39648591
Based on your expression, I think you would  just need:

SVC_MONTH: Month(Format(Mid([SVC_DATE],5,2) & "/" & Mid([SVC_DATE],7,2) & "/" & Left([SVC_DATE],4),"mm/dd/yyyy"))

And set the criteria

= Month(Date())
0
 

Author Closing Comment

by:ghettocounselor
ID: 39648596
Sweet!
Works as advertised.
Appreciate the quick reply.
0
 
LVL 39

Expert Comment

by:als315
ID: 39648598
You can use DateSerial(Y,M,D) for conversion if you like to use date functions:
DateSerial(Left([SVC_DATE],4), Mid([SVC_DATE],5,2), Mid([SVC_DATE],7,2))
but in you case month is equal to Mid([SVC_DATE],7,2)
and
SVC_MONTH: CCInt(Mid([SVC_DATE],7,2))
should be enough
0

Featured Post

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…

815 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now