'-- убирает лишние символы для сохранения числа в базе Oracle
Public Function Num4Ora(param)
Dim rg As Object
On Error GoTo err12345
Num4Ora = Null
If Nz(param, "") = "" Then Exit Function
Set rg = CreateObject("VBScript.RegExp")
rg.Global = True
rg.Pattern = "[^(0-9)|\-|\,|\.]": param = rg.Replace(param, "")
rg.Pattern = "\,": param = rg.Replace(param, ".")
param = Replace(param, "..", ".")
Num4Ora = param
Exit Function
err12345:
MsgBox Error, vbExclamation, "Num4Ora #" & Err.Number
Exit Function
End Function
|