📄 查询单个号码.frm
字号:
Set rs = db.OpenRecordset("select * from com where 企业电话 like '*" & Text1.Text & "*' " & " order by id desc")
If rs.RecordCount = 0 Then
Me.MSFlexGrid1.Clear
Label2.Caption = "没有找到号码。"
Option1.Value = False
Option2.Value = True
GoTo dd:
ElseIf rs.RecordCount > 0 Then
rs.MoveLast
rs.MoveFirst
SumRs = 1
Me.MSFlexGrid1.Clear
Me.MSFlexGrid1.Rows = 1
Me.MSFlexGrid1.Cols = 3
Me.MSFlexGrid1.ColWidth(0) = 2000
Me.MSFlexGrid1.ColWidth(2) = 4600
Me.MSFlexGrid1.ColWidth(1) = 700
Me.MSFlexGrid1.TextMatrix(0, 0) = "相似的号码(电话)"
Me.MSFlexGrid1.TextMatrix(0, 2) = "号码的说明"
Me.MSFlexGrid1.TextMatrix(0, 1) = "ID"
Me.MSFlexGrid1.Rows = rs.RecordCount + 1
Dim i As Double
SumRs = rs.RecordCount + 1
Label2.Visible = False
Me.Shape1.Visible = True
Me.ProgressBar1.Visible = True
Me.ProgressBar1.Min = 0
Me.ProgressBar1.Max = rs.RecordCount
For i = 1 To rs.RecordCount
Me.MSFlexGrid1.TextMatrix(i, 0) = rs!企业电话
Me.MSFlexGrid1.TextMatrix(i, 1) = rs!id
Me.MSFlexGrid1.TextMatrix(i, 2) = rs!企业名称
rs.MoveNext
Me.ProgressBar1.Value = i
DoEvents
Next i
Me.MSFlexGrid1.Refresh
Label2.Caption = "查找结束,共找到:" & rs.RecordCount & " 条。"
Me.Label5.Caption = "企业。"
Me.Shape1.Visible = False
Me.ProgressBar1.Visible = False
Me.Label2.Visible = True
End If
ElseIf Option2.Value = True Then '如果搜索的范围为企业传真字段
Set rs = db.OpenRecordset("select * from com where 企业传真 like '*" & Text1.Text & "*' " & " order by id desc")
If rs.RecordCount = 0 Then
Me.MSFlexGrid1.Clear
Label2.Caption = "没有找到号码。"
Option2.Value = False
Option3.Value = True
GoTo dd:
ElseIf rs.RecordCount > 0 Then
rs.MoveLast
rs.MoveFirst
SumRs = 1
Me.MSFlexGrid1.Clear
Me.MSFlexGrid1.Rows = 1
Me.MSFlexGrid1.Cols = 3
Me.MSFlexGrid1.ColWidth(0) = 2000
Me.MSFlexGrid1.ColWidth(1) = 700
Me.MSFlexGrid1.ColWidth(2) = 4600
Me.MSFlexGrid1.TextMatrix(0, 0) = "相似的号码(传真)"
Me.MSFlexGrid1.TextMatrix(0, 1) = "ID"
Me.MSFlexGrid1.TextMatrix(0, 2) = "企业名称"
Me.MSFlexGrid1.Rows = rs.RecordCount + 1
Dim ii As Double
SumRs = rs.RecordCount + 1
Label2.Visible = False
Me.Shape1.Visible = True
Me.ProgressBar1.Visible = True
Me.ProgressBar1.Min = 0
Me.ProgressBar1.Max = rs.RecordCount
For ii = 1 To rs.RecordCount
Me.MSFlexGrid1.TextMatrix(ii, 0) = rs!企业传真
Me.MSFlexGrid1.TextMatrix(ii, 1) = rs!id
Me.MSFlexGrid1.TextMatrix(ii, 2) = rs!企业名称
rs.MoveNext
Me.ProgressBar1.Value = ii
Label2.Caption = "已经找到:" & rs.RecordCount & " 条。"
DoEvents
Next ii
Me.MSFlexGrid1.Refresh
Label2.Caption = "查找结束,共找到:" & rs.RecordCount & " 条。"
Me.Label5.Caption = "企业。"
Me.Shape1.Visible = False
Me.ProgressBar1.Visible = False
Me.Label2.Visible = True
End If
ElseIf Option3.Value = True Then
Set rs = db.OpenRecordset("select * from ren where 手机号码 like '*" & Text1.Text & "*' order by 姓名")
If rs.RecordCount = 0 Then
Me.MSFlexGrid1.Clear
Label2.Caption = "没有找到号码。"
Option3.Value = False
Option4.Value = True
GoTo dd:
ElseIf rs.RecordCount > 0 Then
rs.MoveLast
rs.MoveFirst
SumRs = 1
Me.MSFlexGrid1.Clear
Me.MSFlexGrid1.Rows = 1
Me.MSFlexGrid1.Cols = 4
Me.MSFlexGrid1.ColWidth(0) = 1500
Me.MSFlexGrid1.ColWidth(2) = 2000
Me.MSFlexGrid1.ColWidth(1) = 700
Me.MSFlexGrid1.ColWidth(3) = 4000
Me.MSFlexGrid1.TextMatrix(0, 0) = "相似的号码(手机)"
Me.MSFlexGrid1.TextMatrix(0, 1) = "ID"
Me.MSFlexGrid1.TextMatrix(0, 2) = "姓名(职务)"
Me.MSFlexGrid1.TextMatrix(0, 3) = "归属的企业名称"
Me.MSFlexGrid1.Rows = rs.RecordCount + 1
Dim iii As Double
SumRs = rs.RecordCount + 1
Label2.Visible = False
Me.Shape1.Visible = True
Me.ProgressBar1.Visible = True
Me.ProgressBar1.Min = 0
Me.ProgressBar1.Max = rs.RecordCount
For iii = 1 To rs.RecordCount
Me.MSFlexGrid1.TextMatrix(iii, 0) = rs!手机号码
Me.MSFlexGrid1.TextMatrix(iii, 1) = rs!id
If IsNull(rs!部门) = False Then
If Trim(rs!部门) <> "" Then
bm = rs!部门
End If
End If
If IsNull(rs!职务) = False Then
If Trim(rs!职务) <> "" Then
zw = rs!职务
End If
End If
If zw <> "" Then
fj = "[" & bm & ":" & zw & "]"
End If
If bm = "" Then
fj = "[" & zw & "]"
End If
If zw = "" And bm = "" Then
fj = ""
End If
xm = Trim(rs!姓名)
If Len(xm) = 1 Then
xm = xm & " "
ElseIf Len(xm) = 2 Then
xm = Left(xm, 1) & " " & Right(xm, 1)
Else
xm = xm
End If
Me.MSFlexGrid1.TextMatrix(iii, 2) = xm & " " & fj
bm = "": zw = "": fj = ""
xm = ""
Set rs2 = Db2.OpenRecordset("select * from com where id =" & rs!所属企业)
If rs2.RecordCount > 0 Then
rs2.MoveLast
rs2.MoveFirst
End If
If rs2.RecordCount > 1 Then
Me.MSFlexGrid1.TextMatrix(iii, 3) = "(查找所属企业名称失败,找到多个!)"
ElseIf rs2.RecordCount = 1 Then
Me.MSFlexGrid1.TextMatrix(iii, 3) = rs2!企业名称
ElseIf rs2.RecordCount = 0 Then
Me.MSFlexGrid1.TextMatrix(iii, 3) = "(查找所属企业名称失败,没有找到!)"
End If
rs.MoveNext
Me.ProgressBar1.Value = iii
DoEvents
Label2.Caption = "已经找到:" & rs.RecordCount & " 条。"
Next iii
Me.MSFlexGrid1.Refresh
Label2.Caption = "查找结束,共找到:" & rs.RecordCount & " 条。"
Me.Label5.Caption = "联系人。"
Me.Shape1.Visible = False
Me.ProgressBar1.Visible = False
Me.Label2.Visible = True
End If
ElseIf Option4.Value = True Then
Set rs = db.OpenRecordset("select * from ren where 小灵通 like '*" & Text1.Text & "*' order by 姓名 ")
If rs.RecordCount = 0 Then
Me.MSFlexGrid1.Clear
Label2.Caption = "没有找到号码。"
Option4.Value = False
Option5.Value = True
GoTo dd:
ElseIf rs.RecordCount > 0 Then
rs.MoveLast
rs.MoveFirst
SumRs = 1
Me.MSFlexGrid1.Clear
Me.MSFlexGrid1.Rows = 1
Me.MSFlexGrid1.Cols = 4
Me.MSFlexGrid1.ColWidth(0) = 1500
Me.MSFlexGrid1.ColWidth(1) = 700
Me.MSFlexGrid1.ColWidth(2) = 1500
Me.MSFlexGrid1.ColWidth(2) = 4000
Me.MSFlexGrid1.TextMatrix(0, 0) = "小灵通号码"
Me.MSFlexGrid1.TextMatrix(0, 1) = "ID"
Me.MSFlexGrid1.TextMatrix(0, 2) = "小灵通机主"
Me.MSFlexGrid1.TextMatrix(0, 3) = "归属的企业名称"
Me.MSFlexGrid1.Rows = rs.RecordCount + 1
Dim iiii As Double
SumRs = rs.RecordCount + 1
Label2.Visible = False
Me.Shape1.Visible = True
Me.ProgressBar1.Visible = True
Me.ProgressBar1.Min = 0
Me.ProgressBar1.Max = rs.RecordCount
For iiii = 1 To rs.RecordCount
Me.MSFlexGrid1.TextMatrix(iiii, 0) = rs!小灵通
Me.MSFlexGrid1.TextMatrix(iiii, 1) = rs!id
If IsNull(rs!部门) = False Then
If Trim(rs!部门) <> "" Then
bm = rs!部门
End If
End If
If IsNull(rs!职务) = False Then
If Trim(rs!职务) <> "" Then
zw = rs!职务
End If
End If
If zw <> "" Then
fj = "[" & bm & ":" & zw & "]"
End If
If bm = "" Then
fj = "[" & zw & "]"
End If
If zw = "" And bm = "" Then
fj = ""
End If
xm = Trim(rs!姓名)
If Len(xm) = 1 Then
xm = xm & " "
ElseIf Len(xm) = 2 Then
xm = Left(xm, 1) & " " & Right(xm, 1)
Else
xm = xm
End If
Me.MSFlexGrid1.TextMatrix(iiii, 2) = xm & " " & fj
bm = "": zw = "": fj = "": xm = ""
Set rs2 = Db2.OpenRecordset("select * from com where id =" & rs!所属企业)
If rs2.RecordCount > 0 Then
rs2.MoveLast
rs2.MoveFirst
End If
If rs2.RecordCount > 1 Then
Me.MSFlexGrid1.TextMatrix(iiii, 3) = "(查找所属企业名称失败,找到多个!)"
ElseIf rs2.RecordCount = 1 Then
Me.MSFlexGrid1.TextMatrix(iiii, 3) = rs2!企业名称
ElseIf rs2.RecordCount = 0 Then
Me.MSFlexGrid1.TextMatrix(iiii, 3) = "(查找所属企业名称失败,没有找到!)"
End If
rs.MoveNext
Me.ProgressBar1.Value = iiii
DoEvents
Label2.Caption = "已经找到:" & rs.RecordCount & " 条。"
Next iiii
Me.MSFlexGrid1.Refresh
Label2.Caption = "查找结束,共找到:" & rs.RecordCount & " 条。"
Me.Label5.Caption = "联系人。"
Me.Shape1.Visible = False
Me.ProgressBar1.Visible = False
Me.Label2.Visible = True
End If
ElseIf Option5.Value = True Then
Set rs = db.OpenRecordset("select * from ren where 办公电话 like '*" & Text1.Text & "*' order by 姓名 ")
If rs.RecordCount = 0 Then
Me.MSFlexGrid1.Clear
Label2.Caption = "没有找到号码。"
Option5.Value = False
Option6.Value = True
GoTo dd:
ElseIf rs.RecordCount > 0 Then
rs.MoveLast
rs.MoveFirst
SumRs = 1
Me.MSFlexGrid1.Clear
Me.MSFlexGrid1.Rows = 1
Me.MSFlexGrid1.Cols = 4
Me.MSFlexGrid1.ColWidth(0) = 2000
Me.MSFlexGrid1.ColWidth(1) = 700
Me.MSFlexGrid1.ColWidth(2) = 1000
Me.MSFlexGrid1.ColWidth(3) = 4500
Me.MSFlexGrid1.TextMatrix(0, 0) = "办公电话"
Me.MSFlexGrid1.TextMatrix(0, 1) = "ID"
Me.MSFlexGrid1.TextMatrix(0, 2) = "姓名"
Me.MSFlexGrid1.TextMatrix(0, 3) = "归属的企业名称"
Me.MSFlexGrid1.Rows = rs.RecordCount + 1
Dim iiiii As Double
SumRs = rs.RecordCount + 1
Label2.Visible = False
Me.Shape1.Visible = True
Me.ProgressBar1.Visible = True
Me.ProgressBar1.Min = 0
Me.ProgressBar1.Max = rs.RecordCount
For iiiii = 1 To rs.RecordCount
Me.MSFlexGrid1.TextMatrix(iiiii, 0) = rs!办公电话
Me.MSFlexGrid1.TextMatrix(iiiii, 1) = rs!id
Me.MSFlexGrid1.TextMatrix(iiiii, 2) = rs!姓名
Set rs2 = Db2.OpenRecordset("select * from com where id =" & rs!所属企业)
If rs2.RecordCount > 0 Then
rs2.MoveLast
rs2.MoveFirst
End If
If rs2.RecordCount > 1 Then
Me.MSFlexGrid1.TextMatrix(iiiii, 3) = "(查找所属企业名称失败,找到多个!)"
ElseIf rs2.RecordCount = 1 Then
Me.MSFlexGrid1.TextMatrix(iiiii, 3) = rs2!企业名称
ElseIf rs2.RecordCount = 0 Then
Me.MSFlexGrid1.TextMatrix(iiiii, 3) = "(查找所属企业名称失败,没有找到!)"
End If
rs.MoveNext
Me.ProgressBar1.Value = iiiii
DoEvents
Label2.Caption = "已经找到:" & rs.RecordCount & " 条。"
Next iiiii
Me.MSFlexGrid1.Refresh
Label2.Caption = "查找结束,共找到:" & rs.RecordCount & " 条。"
Me.Label5.Caption = "联系人。"
Me.Shape1.Visible = False
Me.ProgressBar1.Visible = False
Me.Label2.Visible = True
End If
ElseIf Option6.Value = True Then
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -