change language display in date with Vb?

ASandoval

New member
Local time
Today, 14:19
Joined
Apr 24, 2010
Messages
6
Hi
I use access 2003 and I need to change the language dates display, from english to spanish without change the regional and language configuration the PC. In Excel I can use the option in the format date [-80A]dd mmm yyy. In access can´t find the way to do this, or I can do with Vb?
Thanks
 
You might need to explain yourself a little better. I think what you mean is that you have a textbox and you want people to enter dates in this text box. You have some people with a windows regional setting of English UK and some people with Spanish.

Is this correct?
 
There's a format command for Access too - you can set it in design view of your form, or it can indeed be done with VBA.

So, if you want to change the format of a text box as per darbid's last post, you can put it in VBA like this:

[textboxname].format = "mm/dd/yyyy"
 
I will wait for him/her to reply but actually how I deal with UK/DE/JP/CN dates which are all different is

Format is always "Short Date"

Then depending on the regional settings in the form load I change this eg

UK
InputMask = "99/99/0000;0;_"

JP
InputMask = "0000/00/99;0;_"

To determine the regional setting I use a windows api called GetLocaleInfoA
 
Hmm in that case you might want a select case in the on open of your form, to determine the country and then set the input mask based on that. so something like

dim Locale_Value as string

Locale_Value=getlocaleinfoA()

select case locale_value
case UK
.....
 
Let me explain better.
My PC have the US region configuration and can't be modify because the server of the company is in the United State. My problem is that in the reports, I need that the months and/or days name be display in Spanish (Enero 15, 2010) instead of English (January 15, 2010).
The question is if there are a way that this happen without change the configuration of my PC, using Visual basic or any other alternative.

Thanks
Alejandro
 
Let me explain better.
My PC have the US region configuration and can't be modify because the server of the company is in the United State. My problem is that in the reports, I need that the months and/or days name be display in Spanish (Enero 15, 2010) instead of English (January 15, 2010).
The question is if there are a way that this happen without change the configuration of my PC, using Visual basic or any other alternative.

Thanks
Alejandro

You could do this with a lookup table or array. (Found this translation on google)
* enero — January
* febrero — February
* marzo — March
* abril — April
* mayo — May
* junio — June
* julio — July
* agosto — August
* septiembre, setiembre — September
* octubre — October
* noviembre — November
* diciembre — December

Dim Months_Spanish(11) as string

Months_Spanish(0) ="enero"
Months_Spanish(1) ="febrero"
Months_Spanish(2) ="marzo"
...
Months_Spanish(11) ="diciembre"

For displaying in a report, use the month value of the date, as an index in the array. Because an array is 0 based you may have to subtract 1 from month to get proper index. Also, you'll have to deal with capitalization as necessary.
This is how I'd approach the issue. No change to PC configuration. You could do the same sort of thing for other languages as well.

Hope this is useful.
 
Haven't you got a similar question running on another thread? I thought I answred this in a similar fashion on another thread....
 
Hi ASandoval,

jdraw has pretty much given the same solution I would. I have a similar problem when I want people who are working in german to display a Day or Month name in english.

To fully get them all i set up some functions in a module. The first is for the month and the second is for the day. But I also put a short form and long form option. Somthing like;

getmonth(str_month as string, bln_shortform as boolean) as string

Then you check long form or short form with bln_shortform

Then use a select case

eg

Select Case str_month

Case = "enero"
getmonth = "January"


Case Else

getmonth = str_month

I always have a case else in case it fails so at least you get a month.

So I would have one for the short forms of the month.


I would then have a similar function for the days in both long form "Monday" and short form "Mon"
 
So 3 people have provided the solution on 2 threads. Original poster, please keep it to one thread per question. Would have saved 2 of us a bit of time.....
 

Users who are viewing this thread

Back
Top Bottom