允许用户输入接受两种不同的输入格式 [英] Allow user input to accept two different input format
本文介绍了允许用户输入接受两种不同的输入格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用文本框来接受两个不同的格式值,例如"1xxx-xxxxx"和"xxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxx",该代码已经接受了"1xxx-xxxxx"格式,我需要包括第二种格式:
非常感谢您的帮助.
I am trying to use a textbox to accept two different format value such as "1xxx-xxxxx" and "xxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxx" the code is accepting "1xxx-xxxxx" format already I need to include the second format:
Your help is highly appreciated.
Public Sub ValidFormatNo As String, sFCd As String, DataBase As Myabase)
Dim sSelect As String
Dim rsRecords As Object
Dim sNo As String
Dim eSave As SaveError
On Error GoTo 0
If Len(sFormatNo)= FORMATNOLGTH Then
If Mid(sFormatNo, 5, 1) = "-" Then
sSelect = "Select * from FORMATNO where acct = '" _
& Mid(sFormatNo, 1, 4) & "'"
On Error Resume Next
Call DataBase.SelectSnapshot(rsRecords, sSelect)
If Err.Number = 0 Then
On Error GoTo 0
sNo = Right(sChargeNo, Len(sChargeNo) - 5)
Select Case rsRecords("rule").Value
Case "".....
End If
End If
End If
推荐答案
If Len(sFormatNo)= FORMATNOLGTH Then
If Mid(sFormatNo, 5, 1) = "-" Then
sSelect = "Select * from FORMATNO where acct = '" _
& Mid(sFormatNo, 1, 4) & "'"
On Error Resume Next
Call DataBase.SelectSnapshot(rsRecords, sSelect)
If Err.Number = 0 Then
On Error GoTo 0
sNo = Right(sChargeNo, Len(sChargeNo) - 5)
Select Case rsRecords("rule").Value
Case "".....
End If
End If
elseIf Len(sFormatNo)= FORMATNOLGTH2 then 'the length of ur other string
If Mid(sFormatNo, 10, 1) = "-" then
'Do whatever you need
end if
end if
这篇关于允许用户输入接受两种不同的输入格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文