我对 MS Access VBADateValue
函数有一个奇怪的问题:当我将值“2012 年 5 月 4 日”传递给它时,它会因类型不匹配错误而失败。
我认为是由于内部日期格式,但我不知道如何在代码级别更改该格式!
目前我的解决方案是:
Public Function DateToStr(Value)
Dim Parts As Variant Parts = Split(Value, " ")
Dim Month As String
Select Case Parts(1)
Case "Jan"
Month = "Gen"
Case "May"
Month = "Mag"
Case "Jun"
Month = "Giu"
Case "Jul"
Month = "Lug"
Case "Aug"
Month = "Ago"
Case "Sep"
Month = "Set"
Case "Oct"
Month = "Ott"
Case "Dec"
Month = "Dic"
Case Else
Month = Parts(1) End Select
DateToStr = CDate(Parts(0) & "/" & Month & "/" & Parts(2))
End Function
你有什么主意吗?!?
PS:我的环境是意大利语。