Regional differences

  • Thread starter Thread starter apemen
  • Start date Start date
A

apemen

Hi,
I try to insert a decimal number,say, "3.45" to a field,
but because my regional settings are for europe,
decimal separator is ","
so "3.45" is taken as "345" by Access.

How can I insert a decimal number, no matter is reginal setting?

Thank you.
 
You could detect the regional settings on the Form_Load and set the input
mask accordingly.

PS UK is . separator
 
Yep, point taken.

I may have a chance to have a play with this later, but if anyone else has a
suggestion please jump in.. ...
 
Hi,


Replace( ) to replace the , for a , would work probably anywhere dot
and coma can be in used for decimal delimiter. If you have the US setting on
you PC, you can also try InUSPlease, like here down:

============================
Option Compare Database
Option Explicit

Declare Function VariantChangeTypeEx _
Lib "oleaut32.dll" _
(ByRef pvargDest As Variant, _
ByRef pvarSrc As Variant, _
ByVal lcid As Long, _
ByVal wFlags As Integer, _
ByVal vt As VbVarType) As Long

Public Declare Function SetSystemTime Lib "kernel32" (lpSystemTime As
SYSTEMTIME) As Long


Public Function InUSplease(Whatever As Variant) As String
Dim tmp As Variant
VariantChangeTypeEx tmp, Whatever, 1033, 0, vbString
InUSplease = tmp
End Function



==============================

If you don't have the locale 1033 installed on your PC, that won't work,
but otherwise, whatever is the decimal delimiter, say a semi colon, .then


? InUSPlease( 3 / 4 )
0.75



Hoping it may help,
Vanderghast, Access MVP
 
Back
Top