📄 frmkehufind.frm
字号:
VERSION 5.00
Begin VB.Form Frmkehufind
BackColor = &H00C0FFFF&
Caption = "客户资料查询"
ClientHeight = 7890
ClientLeft = 60
ClientTop = 450
ClientWidth = 8775
LinkTopic = "Form7"
MaxButton = 0 'False
ScaleHeight = 7890
ScaleWidth = 8775
StartUpPosition = 2 '屏幕中心
Begin VB.PictureBox gridkehu
Height = 4935
Left = 240
ScaleHeight = 4875
ScaleWidth = 8115
TabIndex = 1
Top = 2760
Width = 8175
End
Begin VB.Frame Frame1
BackColor = &H00C0FFFF&
Caption = "查找条件"
Height = 2295
Left = 240
TabIndex = 0
Top = 240
Width = 8175
Begin VB.PictureBox Printgrid1
Height = 480
Left = 6720
ScaleHeight = 420
ScaleWidth = 1140
TabIndex = 13
Top = 1920
Width = 1200
End
Begin VB.CommandButton Command3
Caption = "退出"
Height = 375
Left = 6600
TabIndex = 12
Top = 840
Width = 1095
End
Begin VB.CommandButton Command2
Caption = "打印"
Height = 375
Left = 6600
TabIndex = 11
Top = 240
Width = 1095
End
Begin VB.CommandButton Command1
Caption = "查询"
Height = 375
Left = 360
TabIndex = 10
Top = 1680
Width = 1215
End
Begin VB.TextBox txtcard
Height = 375
Left = 4200
TabIndex = 9
Top = 960
Width = 1335
End
Begin VB.TextBox txtname
Height = 375
Left = 1560
TabIndex = 8
Top = 1080
Width = 1335
End
Begin VB.TextBox txtcell
Height = 375
Left = 4200
TabIndex = 7
Top = 240
Width = 1335
End
Begin VB.TextBox txtID
Height = 375
Left = 1560
TabIndex = 6
Top = 240
Width = 1335
End
Begin VB.OptionButton Optioncar
BackColor = &H00C0FFFF&
Caption = "车牌号"
Height = 375
Left = 3240
TabIndex = 5
Top = 960
Width = 975
End
Begin VB.OptionButton Optioncell
BackColor = &H00C0FFFF&
Caption = "手机号"
Height = 375
Left = 3240
TabIndex = 4
Top = 240
Width = 855
End
Begin VB.OptionButton Optionname
BackColor = &H00C0FFFF&
Caption = "客户姓名"
Height = 495
Left = 360
TabIndex = 3
Top = 960
Width = 1215
End
Begin VB.OptionButton OptionID
BackColor = &H00C0FFFF&
Caption = "身份证号"
Height = 375
Left = 360
TabIndex = 2
Top = 240
Width = 1095
End
End
End
Attribute VB_Name = "Frmkehufind"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim rs_kehu As New ADODB.Recordset '楼盘
Private Sub Command1_Click()
Dim sql As String
On Error GoTo loaderror
gridkehu.Clear
If optionid.Value = True Then
sql = "select * from 客户资料 where Hon_ID = '" & txtID.Text & "'"
rs_kehu.CursorLocation = adUseClient
rs_kehu.Open sql, conn, adOpenKeyset, adLockPessimistic
setgrid
setgridhead
displaygrid
rs_kehu.Close
Exit Sub
End If
'按照姓名查询
If Optionname.Value = True Then
sql = "select * from 客户资料 where Hon_name = '" & txtname.Text & "'"
rs_kehu.CursorLocation = adUseClient
rs_kehu.Open sql, conn, adOpenKeyset, adLockPessimistic
setgrid
setgridhead
displaygrid
rs_kehu.Close
Exit Sub
End If
'按照手机号查询
If Optioncell.Value = True Then
sql = "select * from 客户资料 where Hon_handset = '" & txtcell.Text & "'"
rs_kehu.CursorLocation = adUseClient
rs_kehu.Open sql, conn, adOpenKeyset, adLockPessimistic
setgrid
setgridhead
displaygrid
rs_kehu.Close
Exit Sub
End If
'按照车牌号查询
If Optioncar.Value = True Then
sql = "select * from 客户资料 where Hon_carcode = '" & txtcard.Text & "'"
rs_kehu.CursorLocation = adUseClient
rs_kehu.Open sql, conn, adOpenKeyset, adLockPessimistic
setgrid
setgridhead
displaygrid
rs_kehu.Close
Exit Sub
End If
Exit Sub
loaderror:
MsgBox Err.Description
End Sub
Private Sub Command2_Click()
Printgrid1.Unit = Centimeter
Printgrid1.PrintObject = gridkehu
Printgrid1.DoPreView
End Sub
Private Sub Command3_Click()
Unload Me
End Sub
Private Sub Form_Load()
Dim sql As String
On Error GoTo loaderror
sql = "select * from 客户资料"
rs_kehu.CursorLocation = adUseClient
rs_kehu.Open sql, conn, adOpenKeyset, adLockPessimistic
setgrid
setgridhead
displaygrid
rs_kehu.Close
Exit Sub
loaderror:
MsgBox Err.Description
End Sub
Public Sub displaygrid()
Dim i As Integer
Dim j As Integer
On Error GoTo displayerror
gridkehu.Row = 0
If Not rs_kehu.EOF Then
rs_kehu.MoveFirst
Do While Not rs_kehu.EOF
gridkehu.Row = gridkehu.Row + 1
For j = 0 To 11
gridkehu.Col = j
If Not IsNull(rs_kehu.Fields(j)) Then gridkehu.Text = _
rs_kehu.Fields(j) Else gridkehu.Text = ""
Next j
rs_kehu.MoveNext
Loop
End If
displayerror:
If Err.Number <> 0 Then
MsgBox Err.Description
End If
End Sub
Public Sub setgrid()
Dim i As Integer
On Error GoTo seterror
With gridkehu
.ScrollBars = flexScrollBarBoth
.FixedCols = 1
.Rows = rs_kehu.RecordCount + 1
.Cols = 12
.SelectionMode = flexSelectionByRow
For i = 0 To .Rows - 1
.RowHeight(i) = 315
Next
For i = 0 To .Cols - 1
.ColWidth(i) = 1500
Next i
End With
Exit Sub
seterror:
MsgBox Err.Description
End Sub
Public Sub setgridhead()
On Error GoTo setheaderror
gridkehu.Row = 0
gridkehu.Col = 0
gridkehu.Text = "身份证号"
gridkehu.Col = 1
gridkehu.Text = "姓名"
gridkehu.Col = 2
gridkehu.Text = "性别"
gridkehu.Col = 3
gridkehu.Text = "电话"
gridkehu.Col = 4
gridkehu.Text = "手机"
gridkehu.Col = 5
gridkehu.Text = "职业"
gridkehu.Col = 6
gridkehu.Text = "出生日期"
gridkehu.Col = 7
gridkehu.Text = "电子邮件"
gridkehu.Col = 8
gridkehu.Text = "车牌号"
gridkehu.Col = 9
gridkehu.Text = "邮编"
gridkehu.Col = 10
gridkehu.Text = "通信地址"
gridkehu.Col = 11
gridkehu.Text = "备注"
Exit Sub
setheaderror:
MsgBox Err.Description
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -