formating date from text to normal text

megatronixs

Registered User.
Local time
Today, 23:04
Joined
Aug 17, 2012
Messages
719
Hi all,

I have 2 fields inside a form that are used to run a query.
the only thing is that the first field will be filled in, and the second field needs to format the text into a date.
Field 1 is called from_date_text and field 2 is called limit_date_text
in the first field I have the date like this: 20121210 and need to convert it to 10/12/2012.
I tried to use it like this in the second field: =[from_date_text].DateValue("10/12/2012") but no luck.

any tips in getting this working?

Greetings.
 
you need to use the string functions. try

=DateValue(left([from_date_text],2) & "/" & mid([from_date_text],3,2) & "/" & right([from_date_text],4))
 
Hi,
I don't get it to work, just get the error #Name?
but then I actually saw it is stored in number format :-(
my mistake.

Greetings.
 
CJ's suffering from a little bit of dyslexia, this morning...testing shows it should be

=DateValue(Right([from_date_text],2) & "/" & mid([from_date_text],3,2) & "/" & Left([from_date_text],4))

if the example given is correct, i.e going from

20121210

to

10/12/2012

As for it being a Number Datatype, is there any reason you can't simply go into Table Design View and change it from Number to Text? If it's all digits, as indicated, it will convert without a problem.

Linq ;0)>
 
sorry - my mistake - arse and elbow comes to mind
 
hi all,
It worked out :-) BIG THANKS to both.
I was wondering if it can be used also in vba. I will give it a try :-)

Greetings.
 

Users who are viewing this thread

Back
Top Bottom