Storing Dates as xx-xx-xxxx

penfold1992

Registered User.
Local time
Today, 22:58
Joined
Nov 22, 2012
Messages
169
Is there a way I can store dates in this format?

dd-mm-yyyy As a Date field. if i can then I wont need to do some coding... heres the issue.

I have files named in like this:
"DB dd-mm-yyyy.mdb" and I cant use "/"'s in filenames.

I then want to find a record that corresponds to the date of this file so I look for it like so...

SQLstr = "SELECT [Created Date] FROM [Backup] WHERE [Created Date]='" & Listings2(x) & "' ORDER BY [Created Date]"

Where Listing2 is an array of all the filenames (just the dd-mm-yyyy part)

however I recieve an error here and I think its because it cant find any of those dates because the date is not in dd/mm/yyyy format.

Either I need to go through the Array and replace all "-" with "/" or be able to store the date in this format "dd-mm-yyyy"

is that possible?
 
Have you looked into Format function?

yeah i tried but that didnt appear to work... i mean, it changed the string but I still got the error... maybe its my SQL code?

Code:
SELECT [Backup].[Created Date] FROM [Backup] WHERE [Backup].[Created Date]='02/05/2013'

the error is "Data type mismatch in criteria expression"
 
If it is a Date you are dealing with in SQL, you use the has tags..
Code:
SELECT Backup.[Created Date] FROM Backup WHERE Backup.[Created Date]= #02/05/2013#;
Also remember the International Date Formatting problems with Access SQL.
 
If it is a Date you are dealing with in SQL, you use the has tags..
Code:
SELECT Backup.[Created Date] FROM Backup WHERE Backup.[Created Date]= #02/05/2013#;
Also remember the International Date Formatting problems with Access SQL.

ahh it was the #'s that I was missing. I forgot about that, and yes the international date issue... -.- lets not start off with that debate everytime it pops up lol:banghead:
 
Ha ha.. I know.. :p

I take that you have solved your problem now?

solved my problem? yes thank you :)

solved my problem's certainly not :rolleyes: u know what its like :p

thanks very much once again for your help
 

Users who are viewing this thread

Back
Top Bottom