检查输入的数据是否符合YYYY-MM
时 间:2020-10-29 19:54:40
作 者:易勋 ID:35404 城市:上海
摘 要:在控制输入数据的时候,经常要求用户输入YYYY-MM的格式,例如:2020-10,为了规范输入,通过一个函数实现了这个功能。
正 文:
函 数:
Public Function CheckMonth(strMonth As String) As Boolean
CheckMonth = True
If Len(strMonth) <> 7 Then
CheckMonth = False
End If
If Mid(strMonth, 5, 1) <> "-" Then
CheckMonth = False
End If
If Val(Left(strMonth, 4)) < 2000 or Val(Left(strMonth, 4)) > 2100 Then
CheckMonth = False
End If
If Val(Right(strMonth, 2)) < 1 or Val(Right(strMonth, 2)) > 12 Then
CheckMonth = False
End If
End Function
调 用:
CheckMonth(数据)将输入的数据作为参数传递给该函数,函数返回True或False
Access软件网官方交流QQ群 (群号:54525238) Access源码网店
常见问答:
技术分类:
源码示例
- 【源码QQ群号19834647...(12.17)
- Access怎么按年龄段来统计...(01.26)
- 【Access高效办公】上一年...(12.29)
- 用Access连续窗体制作的树...(11.03)
- 【Access高效办公】上一年...(10.30)
- Access制作的RGB转CM...(09.22)
- Access制作的RGB调色板...(09.15)
- Access制作的快速车牌输入...(09.13)
- 【Access高效办公】统计当...(06.30)
- 【Access高效办公】用复选...(06.24)
学习心得
最新文章
- Access快速开发平台--自动创...(02.09)
- Access快速开发平台--错误号...(02.02)
- Access怎么按年龄段来统计人数...(01.26)
- 【Access更新查询示例】怎么把...(01.19)
- Access快速开发平台--错误号...(01.13)
- Access快速开发平台--错误号...(01.04)
- 【Access高效办公】上一年度累...(12.29)
- Access快速开发平台--2.6...(12.24)
- Access快速开发平台企业版--...(12.10)
- SqlServer默认当前时间用什...(11.28)


.gif)
