📄 search.frm
字号:
'If Len(Trim(Combo2.Text)) > NumLong - 1 And Trim(Combo2.Text) <> "全部" Then
' KeyAscii = 0
' Exit Sub
'End If
Dim Numbers As String
Numbers = "1234567890" + Chr(8) + Chr(46)
If InStr(Numbers, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
End If
End Sub
Private Sub Command1_Click()
If Not CheckFor Then Exit Sub
Call fSear '调用查询函数查询
Unload Me
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
myMain.Hide
ChanelNum = 8
NumLong = 7
Dim i As Integer
i = 0
Dim Sql As String
Dim Rs As ADODB.Recordset
Set Rs = New ADODB.Recordset
Sql = "select DISTINCT phoneNo from file"
If Not mExecuteSql(Sql, Rs) Then MsgBox "数据库查询错误", vbOKOnly + vbExclamation, "错误"
While (Not Rs.EOF)
Combo2.AddItem Rs.Fields(0), i
Rs.MoveNext
i = i + 1
Wend
End Sub
Private Sub Text1_Change()
If Len(Trim(Text1.Text)) = 4 Then
Text2.SetFocus
End If
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
Dim Numbers As String
Numbers = "1234567890" + Chr(8) + Chr(46)
If InStr(Numbers, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
End If
End Sub
Private Sub Text10_Change()
If Len(Trim(Text10.Text)) = 2 Then
Combo1.SetFocus
End If
End Sub
Private Sub Text10_LostFocus()
If Len(Trim(Text10.Text)) = 0 Then Exit Sub
If Val(Text10.Text) < 0 Or Val(Text10.Text) > 59 Then
MsgBox "分不能小于0或大于59,请重新输入 ", vbOKOnly + vbInformation, "提示"
Text10.Text = ""
Text10.SetFocus
End If
End Sub
Private Sub Text2_Change()
If Len(Trim(Text2.Text)) = 4 Then
Text3.SetFocus
End If
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
Dim Numbers As String
Numbers = "1234567890" + Chr(8) + Chr(46)
If InStr(Numbers, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
End If
End Sub
Private Sub Text3_Change()
If Len(Trim(Text3.Text)) = 2 Then
Text4.SetFocus
End If
End Sub
Private Sub Text3_KeyPress(KeyAscii As Integer)
Dim Numbers As String
Numbers = "1234567890" + Chr(8) + Chr(46)
If InStr(Numbers, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
End If
End Sub
Private Sub Text3_LostFocus()
If Len(Trim(Text3.Text)) = 0 Then Exit Sub
If Val(Text3.Text) < 1 Or Val(Text3.Text) > 12 Then
MsgBox "月份不能小于1或大于12,请重新输入 ", vbOKOnly + vbInformation, "提示"
Text3.Text = ""
Text3.SetFocus
End If
End Sub
Private Sub Text4_Change()
If Len(Trim(Text4.Text)) = 2 Then
Text5.SetFocus
End If
End Sub
Private Sub Text4_KeyPress(KeyAscii As Integer)
Dim Numbers As String
Numbers = "1234567890" + Chr(8) + Chr(46)
If InStr(Numbers, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
End If
End Sub
Private Sub Text4_LostFocus()
If Len(Trim(Text4.Text)) = 0 Then Exit Sub
If Val(Text4.Text) < 1 Or Val(Text4.Text) > 12 Then
MsgBox "月份不能小于1或大于12,请重新输入 ", vbOKOnly + vbInformation, "提示"
Text4.Text = ""
Text4.SetFocus
End If
End Sub
Private Sub Text5_Change()
If Len(Trim(Text5.Text)) = 2 Then
Text6.SetFocus
End If
End Sub
Private Sub Text5_KeyPress(KeyAscii As Integer)
Dim Numbers As String
Numbers = "1234567890" + Chr(8) + Chr(46)
If InStr(Numbers, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
End If
End Sub
Private Sub Text5_LostFocus()
If Len(Trim(Text5.Text)) = 0 Then Exit Sub
If Val(Text5.Text) < 1 Or Val(Text5.Text) > 31 Then
MsgBox "日期不能小于1或大于31,请重新输入 ", vbOKOnly + vbInformation, "提示"
Text5.Text = ""
Text5.SetFocus
End If
End Sub
Private Sub Text6_Change()
If Len(Trim(Text6.Text)) = 2 Then
Text7.SetFocus
End If
End Sub
Private Sub Text6_KeyPress(KeyAscii As Integer)
Dim Numbers As String
Numbers = "1234567890" + Chr(8) + Chr(46)
If InStr(Numbers, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
End If
End Sub
Private Sub Text6_LostFocus()
If Len(Trim(Text6.Text)) = 0 Then Exit Sub
If Val(Text6.Text) < 1 Or Val(Text6.Text) > 31 Then
MsgBox "日期不能小于1或大于31,请重新输入 ", vbOKOnly + vbInformation, "提示"
Text6.Text = ""
Text6.SetFocus
End If
End Sub
Private Sub Text7_Change()
If Len(Trim(Text7.Text)) = 2 Then
Text8.SetFocus
End If
End Sub
Private Sub Text7_KeyPress(KeyAscii As Integer)
Dim Numbers As String
Numbers = "1234567890" + Chr(8) + Chr(46)
If InStr(Numbers, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
End If
End Sub
Private Sub Text7_LostFocus()
If Len(Trim(Text7.Text)) = 0 Then Exit Sub
If Val(Text7.Text) < 0 Or Val(Text7.Text) > 23 Then
MsgBox "时不能小于0或大于23,请重新输入 ", vbOKOnly + vbInformation, "提示"
Text7.Text = ""
Text7.SetFocus
End If
End Sub
Private Sub Text8_Change()
If Len(Trim(Text8.Text)) = 2 Then
Text9.SetFocus
End If
End Sub
Private Sub Text8_KeyPress(KeyAscii As Integer)
Dim Numbers As String
Numbers = "1234567890" + Chr(8) + Chr(46)
If InStr(Numbers, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
End If
End Sub
Private Sub Text8_LostFocus()
If Len(Trim(Text8.Text)) = 0 Then Exit Sub
If Val(Text8.Text) < 0 Or Val(Text8.Text) > 23 Then
MsgBox "时不能小于0或大于23,请重新输入 ", vbOKOnly + vbInformation, "提示"
Text8.Text = ""
Text8.SetFocus
End If
End Sub
Private Sub Text9_Change()
If Len(Trim(Text9.Text)) = 2 Then
Text10.SetFocus
End If
End Sub
Private Sub Text9_KeyPress(KeyAscii As Integer)
Dim Numbers As String
Numbers = "1234567890" + Chr(8) + Chr(46)
If InStr(Numbers, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
End If
End Sub
Private Sub Text10_KeyPress(KeyAscii As Integer)
Dim Numbers As String
Numbers = "1234567890" + Chr(8) + Chr(46)
If InStr(Numbers, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
End If
End Sub
Private Sub Text9_LostFocus()
If Len(Trim(Text9.Text)) = 0 Then Exit Sub
If Val(Text9.Text) < 0 Or Val(Text9.Text) > 59 Then
MsgBox "分不能小于0或大于59,请重新输入 ", vbOKOnly + vbInformation, "提示"
Text9.Text = ""
Text9.SetFocus
End If
End Sub
Function CheckFor() As Boolean '检查日期时间的条件输入是否正确
If Trim(Text9.Text) <> "" Then
If Trim(Text7.Text) = "" Or Trim(Text5.Text) = "" Or Trim(Text3.Text) = "" Or Trim(Text1.Text) = "" Then
MsgBox "时间输入不符合要求,详情请察看帮助.", vbOKOnly + vbInformation, "提示"
Text1.SetFocus
CheckFor = False
GoTo MEnd1
End If
End If
If Trim(Text10.Text) <> "" Then
If Trim(Text8.Text) = "" Or Trim(Text6.Text) = "" Or Trim(Text4.Text) = "" Or Trim(Text2.Text) = "" Then
MsgBox "时间输入不符合要求,详情请察看帮助.", vbOKOnly + vbInformation, "提示"
Text1.SetFocus
CheckFor = False
GoTo MEnd1
End If
End If
If Trim(Text7.Text) <> "" Then
If Trim(Text5.Text) = "" Or Trim(Text3.Text) = "" Or Trim(Text1.Text) = "" Then
MsgBox "时间输入不符合要求,详情请察看帮助.", vbOKOnly + vbInformation, "提示"
Text1.SetFocus
CheckFor = False
GoTo MEnd1
End If
End If
If Trim(Text8.Text) <> "" Then
If Trim(Text6.Text) = "" Or Trim(Text4.Text) = "" Or Trim(Text2.Text) = "" Then
MsgBox "时间输入不符合要求,详情请察看帮助.", vbOKOnly + vbInformation, "提示"
Text1.SetFocus
CheckFor = False
GoTo MEnd1
End If
End If
If Trim(Text5.Text) <> "" Then
If Trim(Text3.Text) = "" Or Trim(Text1.Text) = "" Then
MsgBox "时间输入不符合要求,详情请察看帮助.", vbOKOnly + vbInformation, "提示"
Text1.SetFocus
CheckFor = False
GoTo MEnd1
End If
End If
If Trim(Text6.Text) <> "" Then
If Trim(Text4.Text) = "" Or Trim(Text2.Text) = "" Then
MsgBox "时间输入不符合要求,详情请察看帮助.", vbOKOnly + vbInformation, "提示"
Text1.SetFocus
CheckFor = False
GoTo MEnd1
End If
End If
If Trim(Text3.Text) <> "" Then
If Trim(Text1.Text) = "" Then
MsgBox "时间输入不符合要求,详情请察看帮助.", vbOKOnly + vbInformation, "提示"
Text1.SetFocus
CheckFor = False
GoTo MEnd1
End If
End If
If Trim(Text4.Text) <> "" Then
If Trim(Text2.Text) = "" Then
MsgBox "时间输入不符合要求,详情请察看帮助.", vbOKOnly + vbInformation, "提示"
Text1.SetFocus
CheckFor = False
GoTo MEnd1
End If
End If
CheckFor = True
MEnd1:
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -