473,698 Members | 2,360 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Query: Convert text to date, display records older than 60 days from Date()

18 New Member
Goal: Convert text to date in a query and show only dates that are older than 60 days from Date()

I’ve searched the site and nothing quite matches what I’m looking for, at least in a way I can comprehend. I can read VBA and SQL at the about the level of a very skilled orangutan.

I’m automating an Excel process using Access. I import Excel files (using DoCmd.TransferS pread…etc) and want to utilize a column named [Posting Date] that contains crappy formatted dates. In Excel, those dates are displayed as DD.MM.YYYY (example: 04.12.2018) but formatted as “General” in Excel. That general column imports as a text column into Access 2016, which my query won’t read as a date without telling it too.

I need a query that turns the text 04.12.2018 into a readable date, and returns records older than 60 days from Date(). I don’t care what display format the query converts the date to (unless you awesome folks tell me I should care), as long as in the end I am viewing records older than 60 days from today. After 60 days of not making a payment, you’re going on the naughty list.

Table Name = CCRejected
Total Columns = A through N
Key Columns = Col A “Customer Number” (number); Col D “Posting Date” (text); Col L “Reason” (text)

Desired outcome: Convert Col D “Posting Date” (text) to a (date) format that can then be further queried for records that are older than 60 days.
Why: If you haven’t paid your bill for over 60 days you can no longer provide you services.

Thanks in advance.
Dec 4 '18 #1
6 1560
twinnyfo
3,653 Recognized Expert Moderator Specialist
jdusn1978,

To get a Date value in Acces, you would use the following Function:

Expand|Select|Wrap|Line Numbers
  1. CDate(Right([Posting Date], 4) & "-" & Mid([Posting Date], 4, 2) & "-" & Left([Posting Date], 2))
That generates the Posting Date "as a date". Notice that we are using String Functions to take apart the string value presented, putting it together into a universal date format ("yyyy-mm-dd"), and then converting it to a Date using the CDate() function.

Then, if you subtract that value from Date(), if that value is greater than 60, they get coal in their stockings!

Hope this hepps.
Dec 4 '18 #2
jdusn1978
18 New Member
Twinnyfo, thank you for replying. It's whiskey:30 here in Germany; I'll take a noob crack at this in the a.m. and report back. I very much appreciate all of you. Merry [your views]mas.
Dec 4 '18 #3
NeoPa
32,569 Recognized Expert Moderator MVP
Well expressed question and humour too. I like it. I can also tell you that Twinny's suggestion should work fine for you.

Let us know if you struggle at all.
Dec 5 '18 #4
jdusn1978
18 New Member
twinnyfo - Works perfectly! Thank you, and I might have some more questions coming your way as I work through this project. You guys rock!

NeoPa - You've been at this for a long while... you helped me a few years ago on a project in the Netherlands. Thank you!
Dec 5 '18 #5
twinnyfo
3,653 Recognized Expert Moderator Specialist
Glad I could hepp you on this problem! Let us know if you have additional questions.
Dec 5 '18 #6
NeoPa
32,569 Recognized Expert Moderator MVP
I can't pretend to remember the details, but certainly would have appreciated a question as fully explained. Also very glad to know I was able to help.

19th October 2006 was when I asked my first question here. I've never regretted a minute of it.
Dec 5 '18 #7

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

Similar topics

4
26361
by: MyOracle | last post by:
Hi everybody, I just curious about change date(0000-00-00) to date (00-00-0000) in mysql.Can anyone tell me about that. Thanks. izmanhaidi.
4
5382
by: Richard Hollenbeck | last post by:
I'm trying to write some code that will convert any of the most popular standard date formats twice in to something like "dd Mmm yyyy" (i.e. 08 Jan 1908) and compare the first with the second and calculate days, months, and years. This is not for a college course. It's for my own personal genealogy website. I'm stumped about the code. I'm working on it but not making much progress. Is there any free code available anywhere? I know it...
12
3851
by: DC Gringo | last post by:
How can I convert this pubLatest to a date with format "m/d/yyyy"? Dim pubLatest As New Date pubLatest = Me.SqlSelectCommand1.Parameters("@pubLatest").Value -- _____ DC G
29
9110
by: james | last post by:
I have a problem that at first glance seems not that hard to figure out. But, so far, the answer has escaped me. I have an old database file that has the date(s) stored in it as number of days. An example is: 36,525 represents 01/01/1900. The starting point date is considered to be : 00/00/0000. I have looked thru Help and used Google and have not really found an answer. I know that Leap Years need to be accounted for too. Any...
1
1921
by: Rick | last post by:
I'm trying to do a SELECT statement looking for a DATE_COMPLETED field which is blank, meaning it has not been completed. The DATE_COMPLETED field is a DATE type field. How do I specify my WHERE conditiion to restrict the results to only those records which have no DATE_COMPLETED data in them? Thanks in advance, Rick
44
10201
by: user | last post by:
Hi, Let's say I have 2 dates in the b/m format: Date 1 and date 2 How do I check whether Date2 is later than Date 1? Date1. 21-Nov-2006 09:00:00 PM
4
39328
by: perryclisbee via AccessMonster.com | last post by:
I have dates of service for several people that range all over each month. ie: patient had dates of service of: 7/3/2006, 7/24/2006 and 7/25/2006. I need to create a new field via a query that will convert each of the records of these service dates to the first date of that month, with results showing: 7/1/2006, 7/1/2006, 7/1/2006. How would you place an expression on a query that will convert any given date to the first day of the month...
8
3361
!NoItAll
by: !NoItAll | last post by:
I am converting about 600-thousand records from Microsoft SQL. The original database designer is, lets just say, "uncooperative." I have several fields that represent date, times, etc. I cannot figure out how the date is stored. I know the field I can get the value I have several known date sample records Here is an example: The following record I know for certain corresponds to the date of 8/9/2002 (month-day-year).
8
7881
by: DAHLKA | last post by:
I have a legacy date stored in a text field in DDMMMYYYY format that I need to convert to a date in MM/DD/YYYY format in Access. Example, convert text stored as 10JAN2017 to date in 01/10/2017 format. How?
0
8678
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8609
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9166
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8899
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7737
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6525
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4621
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3052
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2333
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.