ลองดูตัวอย่างนี้ครับ Fix พศ ไว้ตลอด
Private Sub Data_AfterUpdate()
Dim fixyear As String
If GetUserLocaleInfo(GetSystemDefaultLCID(), &H1009) = 7 Then
Me.RunnungNum = Format(Me.txtDate, "YY") & Format(Me.txtDate, "MM") & Right("00" & DCount([myDate], "[tblRunningNumber]") + 1, 3)
ElseIf GetUserLocaleInfo(GetSystemDefaultLCID(), &H1009) <> 7 Then
fixyear = bYear(Me.txtDate)
Me.RunnungNum = Right(fixyear, 2) & Format(Me.txtDate, "MM") & Right("00" & DCount([myDate], "[tblRunningNumber]") + 1, 3)
End If
End Sub