A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

language date formatting



 
 
Thread Tools Display Modes
  #1  
Old August 6th, 2007, 08:46 AM posted to microsoft.public.access.reports
eaz
external usenet poster
 
Posts: 2
Default language date formatting

My PC is regional setting is dutch

I have to print documents with date format dd-mmm-yyyy

Problem is, that mmm should always be English (not dutch).

How to enforce that?
  #2  
Old August 6th, 2007, 05:16 PM posted to microsoft.public.access.reports
John Spencer
external usenet poster
 
Posts: 7,815
Default language date formatting

The only way I can think of is to write a custom VBA function to return the
month abbreviation.

UNTESTED sample function with no error handling follows

Public Function fEnglishDate (DateIn as Variant)
Dim dateString as String

If IsDate(DateIn) = False Then
fEnglishDate = DateIn
Else
Select Case Month(DateIn)
Case 1 : "Jan"
Case 2: "Feb"
...
Case 12: "Dec"
End Select
FEnglishDate = Format(Day(DateIn),"00") & "-" & dateString & "-" &
Year(DateIn)
End if

End Function

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

"eaz" wrote in message
...
My PC is regional setting is dutch

I have to print documents with date format dd-mmm-yyyy

Problem is, that mmm should always be English (not dutch).

How to enforce that?



  #3  
Old August 6th, 2007, 05:40 PM posted to microsoft.public.access.reports
eaz
external usenet poster
 
Posts: 2
Default language date formatting

I temporarily solved it, by converting the month to a number (01,02,..) with
month function, and link that to a database table with 01 JAN, 02 FEB etc.
This allows me to enter different languages later on.
It is ugly, but at least it works.
Thanks for the reply, and if you happen to see an elegant solution, let me
know.

"John Spencer" wrote:

The only way I can think of is to write a custom VBA function to return the
month abbreviation.

UNTESTED sample function with no error handling follows

Public Function fEnglishDate (DateIn as Variant)
Dim dateString as String

If IsDate(DateIn) = False Then
fEnglishDate = DateIn
Else
Select Case Month(DateIn)
Case 1 : "Jan"
Case 2: "Feb"
...
Case 12: "Dec"
End Select
FEnglishDate = Format(Day(DateIn),"00") & "-" & dateString & "-" &
Year(DateIn)
End if

End Function

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

"eaz" wrote in message
...
My PC is regional setting is dutch

I have to print documents with date format dd-mmm-yyyy

Problem is, that mmm should always be English (not dutch).

How to enforce that?




 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:52 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.