PC Review


Reply
Thread Tools Rate Thread

Access equiv to SQL set date format dmy??

 
 
Simon Harris
Guest
Posts: n/a
 
      14th Jan 2007
Hi All,

I am storing a date value in a table. THe table column data type is set to
short date. My SQL to do the update takes the value from the form, using
CDate(Me.comboInvoiceDate).

When I look at the value in the table, it looks Ok - 11/01/2007. But, when I
view my report, which shows the Month and year for that value, it come out
as November 2007, not January 2007 as expected. I realise why - I have an
ambiguious date, but how do I tell Access the date format to use. I would
like it to use UK format - DD/MM/YYYY

This is my code on my report: CDate(Me.comboInvoiceDate)

Any help will be much appreciated.

Regards,

Simon.

--
--
* Please reply to group for the benefit of all
* Found the answer to your own question? Post it!
* Get a useful reply to one of your posts?...post an answer to another one
* Search first, post later : http://www.google.co.uk/groups
* Want my email address? Ask me in a post...Cos2MuchSpamMakesUFat!


 
Reply With Quote
 
 
 
 
Rick Brandt
Guest
Posts: n/a
 
      14th Jan 2007
Simon Harris wrote:
> Hi All,
>
> I am storing a date value in a table. THe table column data type is
> set to short date.


No, it is not. You have a DateTime field and have set the FORMAT property to
short date. This is a display property only. DateTimes are always stored
exactly the same.

> My SQL to do the update takes the value from the
> form, using CDate(Me.comboInvoiceDate).
>
> When I look at the value in the table, it looks Ok - 11/01/2007. But,
> when I view my report, which shows the Month and year for that value,
> it come out as November 2007, not January 2007 as expected. I realise
> why - I have an ambiguious date, but how do I tell Access the date
> format to use. I would like it to use UK format - DD/MM/YYYY
>
> This is my code on my report: CDate(Me.comboInvoiceDate)
>
> Any help will be much appreciated.


Date literals in Access MUST use US formats (month before day) or a
non-ambigious format like ISO (yyyy-mm-dd) or where the month uses alpha
characters like 11-Jan-2007.

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com


 
Reply With Quote
 
Van T. Dinh
Guest
Posts: n/a
 
      15th Jan 2007
Have you checked the Date/Time settings in the Regional Settings of your
Windows OS?

"Short Date" Format and CDate pick up and use the settings from the Rgional
Settings, AFAIK.

--
HTH
Van T. Dinh
MVP (Access)



"Simon Harris" <too-much-(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi All,
>
> I am storing a date value in a table. THe table column data type is set to
> short date. My SQL to do the update takes the value from the form, using
> CDate(Me.comboInvoiceDate).
>
> When I look at the value in the table, it looks Ok - 11/01/2007. But, when
> I view my report, which shows the Month and year for that value, it come
> out as November 2007, not January 2007 as expected. I realise why - I have
> an ambiguious date, but how do I tell Access the date format to use. I
> would like it to use UK format - DD/MM/YYYY
>
> This is my code on my report: CDate(Me.comboInvoiceDate)
>
> Any help will be much appreciated.
>
> Regards,
>
> Simon.
>
> --
> --
> * Please reply to group for the benefit of all
> * Found the answer to your own question? Post it!
> * Get a useful reply to one of your posts?...post an answer to another one
> * Search first, post later : http://www.google.co.uk/groups
> * Want my email address? Ask me in a post...Cos2MuchSpamMakesUFat!
>



 
Reply With Quote
 
Simon Harris
Guest
Posts: n/a
 
      15th Jan 2007
Hi Van, Yes - These are set correct for the UK (dd/mm/yyyy).

Simon.

"Van T. Dinh" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Have you checked the Date/Time settings in the Regional Settings of your
> Windows OS?
>
> "Short Date" Format and CDate pick up and use the settings from the
> Rgional Settings, AFAIK.
>
> --
> HTH
> Van T. Dinh
> MVP (Access)
>
>
>
> "Simon Harris" <too-much-(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Hi All,
>>
>> I am storing a date value in a table. THe table column data type is set
>> to short date. My SQL to do the update takes the value from the form,
>> using CDate(Me.comboInvoiceDate).
>>
>> When I look at the value in the table, it looks Ok - 11/01/2007. But,
>> when I view my report, which shows the Month and year for that value, it
>> come out as November 2007, not January 2007 as expected. I realise why -
>> I have an ambiguious date, but how do I tell Access the date format to
>> use. I would like it to use UK format - DD/MM/YYYY
>>
>> This is my code on my report: CDate(Me.comboInvoiceDate)
>>
>> Any help will be much appreciated.
>>
>> Regards,
>>
>> Simon.
>>
>> --
>> --
>> * Please reply to group for the benefit of all
>> * Found the answer to your own question? Post it!
>> * Get a useful reply to one of your posts?...post an answer to another
>> one
>> * Search first, post later : http://www.google.co.uk/groups
>> * Want my email address? Ask me in a post...Cos2MuchSpamMakesUFat!
>>

>
>


--------------------------------------------------------------------------------
I am using the free version of SPAMfighter for private users.
It has removed 2630 spam emails to date.
Paying users do not have this message in their emails.
Try SPAMfighter for free now!


 
Reply With Quote
 
Simon Harris
Guest
Posts: n/a
 
      15th Jan 2007
>> I am storing a date value in a table. The table column data type is
>> set to short date.

>
> No, it is not. You have a DateTime field and have set the FORMAT property
> to short date. This is a display property only. DateTimes are always
> stored exactly the same.


Ok, they are stored as a serial yes?

> Date literals in Access MUST use US formats (month before day) or a
> non-ambigious format like ISO (yyyy-mm-dd) or where the month uses alpha
> characters like 11-Jan-2007.


So, does this mean I need to go re-code my database? Or, if I am
understanding you correctly, all my inserts/updates effecting a date column
will have been stored as US format, if so - How do I get these out formatted
to UK standard?

e.g. If my user entered 11/01/2007 (11th January 2007) how do I tell Access
this is the case? One i dea I had was to split the date into day, month and
year (3 strings) before reconstructing into an acceptable (US) date and
entering into the table?

This seems to be a bit of a weakness of Access, in that the forms seem to
respect local regional settings, where as the actual data storage does not.

Many thanks for your help.

Simon.

--------------------------------------------------------------------------------
I am using the free version of SPAMfighter for private users.
It has removed 2630 spam emails to date.
Paying users do not have this message in their emails.
Try SPAMfighter for free now!


 
Reply With Quote
 
Douglas J. Steele
Guest
Posts: n/a
 
      15th Jan 2007
"Simon Harris" <too-much-(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>>> I am storing a date value in a table. The table column data type is
>>> set to short date.

>>
>> No, it is not. You have a DateTime field and have set the FORMAT
>> property to short date. This is a display property only. DateTimes are
>> always stored exactly the same.

>
> Ok, they are stored as a serial yes?
>
>> Date literals in Access MUST use US formats (month before day) or a
>> non-ambigious format like ISO (yyyy-mm-dd) or where the month uses alpha
>> characters like 11-Jan-2007.

>
> So, does this mean I need to go re-code my database? Or, if I am
> understanding you correctly, all my inserts/updates effecting a date
> column will have been stored as US format, if so - How do I get these out
> formatted to UK standard?
>
> e.g. If my user entered 11/01/2007 (11th January 2007) how do I tell
> Access this is the case? One i dea I had was to split the date into day,
> month and year (3 strings) before reconstructing into an acceptable (US)
> date and entering into the table?
>
> This seems to be a bit of a weakness of Access, in that the forms seem to
> respect local regional settings, where as the actual data storage does
> not.


You should probably read Allen Browne's "International Dates in Access" at
http://www.allenbrowne.com/ser-36.html, or what I had in my September, 2003
"Access Answers" column in Pinnacle Publication's "Smart Access". (You can
download the column, and sample database, for free from
http://www.accessmvp.com/DJSteele/SmartAccess.html)

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)



 
Reply With Quote
 
Simon Harris
Guest
Posts: n/a
 
      17th Jan 2007
> You should probably read Allen Browne's "International Dates in Access" at
> http://www.allenbrowne.com/ser-36.html, or what I had in my September,
> 2003 "Access Answers" column in Pinnacle Publication's "Smart Access".
> (You can download the column, and sample database, for free from
> http://www.accessmvp.com/DJSteele/SmartAccess.html)
>
> --
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
> (no e-mails, please!)


Thanks - Will check them out.

--------------------------------------------------------------------------------
I am using the free version of SPAMfighter for private users.
It has removed 2727 spam emails to date.
Paying users do not have this message in their emails.
Try SPAMfighter for free now!


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
MS Access equiv of With(nolock) macroapa Microsoft Access 3 1st Oct 2009 02:02 PM
Re: convert access date Format() to French date , use of ORDER BY SQL Ken Snell \(MVP\) Microsoft Access Queries 1 28th Nov 2008 03:10 PM
Access VBA equiv of Word VBA red6000 Microsoft Access 1 31st Jul 2006 02:28 PM
Converting Date Format from YYYY-MM-DD to Access date format =?Utf-8?B?YWN0aXZlZ2lybA==?= Microsoft Access 3 21st Jun 2005 11:03 PM
Export Outlook date field as date/time format to Access database =?Utf-8?B?QmVja3k=?= Microsoft Outlook Discussion 0 2nd Dec 2004 02:49 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:58 PM.