wrapping dates with # question

M

Marshy

Hi everyone!

I'm from the UK and have always been told when dealing with dates in
access wrap the date with # and put the date in the American format
#mm-dd-yyyy# This has always worked so have never needed to question
it. However now someone who I work with is saying he's always put the
date in the UK format and wraps it with single quotes e.g 'dd-mm-yyyy'
This seems to work okay when I tried it are they any disadvantages to
using it as for me it would be easier.
I've searched the internet high and low to find the reasons behind
this but can't find anything. Everywhere I look says wrap the dates
with #

Can anyone enlighten me?

Thanks in advance!
 
J

John W. Vinson

Hi everyone!

I'm from the UK and have always been told when dealing with dates in
access wrap the date with # and put the date in the American format
#mm-dd-yyyy# This has always worked so have never needed to question
it. However now someone who I work with is saying he's always put the
date in the UK format and wraps it with single quotes e.g 'dd-mm-yyyy'
This seems to work okay when I tried it are they any disadvantages to
using it as for me it would be easier.
I've searched the internet high and low to find the reasons behind
this but can't find anything. Everywhere I look says wrap the dates
with #

Can anyone enlighten me?

Thanks in advance!

The quotemarks cast the value as Text; Access must convert the text string to
a date, and it's not a certainty that it will do so in the way you intend. You
can use an expression using CDate, which honors the computer's regional
settings:

Format(CDate([parameter]), "\#mm\/dd\/yyyy\#"))

to let the user enter a date in a familiar format yet have Access interpret it
correctly.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top