📄 onefind.frm
字号:
VERSION 5.00
Begin VB.Form OneFind
BackColor = &H00C0FFC0&
Caption = "唯一查询"
ClientHeight = 5775
ClientLeft = 60
ClientTop = 450
ClientWidth = 7050
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
LinkTopic = "Form1"
MDIChild = -1 'True
Picture = "OneFind.frx":0000
ScaleHeight = 5775
ScaleWidth = 7050
Begin VB.TextBox cust_nmtxt
Enabled = 0 'False
Height = 375
Left = 4800
TabIndex = 17
Top = 120
Width = 2055
End
Begin VB.TextBox cust_addtxt
Enabled = 0 'False
Height = 375
Left = 1200
TabIndex = 16
Top = 720
Width = 1815
End
Begin VB.TextBox tel_notxt
Enabled = 0 'False
Height = 375
Left = 4800
TabIndex = 15
Top = 720
Width = 1455
End
Begin VB.TextBox e_mailtxt
Enabled = 0 'False
Height = 375
Left = 1200
TabIndex = 14
Top = 1320
Width = 2295
End
Begin VB.TextBox no_of_pertxt
Enabled = 0 'False
Height = 375
Left = 4800
TabIndex = 13
Top = 1320
Width = 1215
End
Begin VB.CommandButton cmdFirst
Caption = "<<"
Height = 375
Left = 600
TabIndex = 12
Top = 3120
Width = 1095
End
Begin VB.CommandButton cmdPreviouse
Caption = "<"
Height = 375
Left = 2040
TabIndex = 11
Top = 3120
Width = 1095
End
Begin VB.CommandButton cmdNext
Caption = ">"
Height = 375
Left = 3480
TabIndex = 10
Top = 3120
Width = 1095
End
Begin VB.CommandButton cmdLast
Caption = ">>"
Height = 375
Left = 4920
TabIndex = 9
Top = 3120
Width = 1095
End
Begin VB.TextBox cust_cdtxt
Enabled = 0 'False
Height = 375
Left = 1200
TabIndex = 8
Top = 120
Width = 1455
End
Begin VB.TextBox start_dttxt
Enabled = 0 'False
Height = 375
Left = 1200
TabIndex = 7
Top = 2520
Width = 2295
End
Begin VB.TextBox cruise_cdtxt
Enabled = 0 'False
Height = 375
Left = 1200
TabIndex = 6
Top = 1920
Width = 1455
End
Begin VB.TextBox oper_cdtxt
Enabled = 0 'False
Height = 375
Left = 4800
TabIndex = 5
Top = 1920
Width = 1455
End
Begin VB.Frame Frame1
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "查询"
ForeColor = &H80000008&
Height = 1455
Left = 480
TabIndex = 1
Top = 3600
Width = 4335
Begin VB.ComboBox FindCombo
Height = 360
ItemData = "OneFind.frx":11621
Left = 120
List = "OneFind.frx":1162B
TabIndex = 4
Text = "查找"
Top = 360
Width = 1215
End
Begin VB.TextBox Findtxt
Height = 375
Left = 1440
TabIndex = 3
Top = 360
Width = 2775
End
Begin VB.CommandButton cmdFindOK
Caption = "查询确认"
Height = 375
Left = 120
TabIndex = 2
Top = 960
Width = 1215
End
End
Begin VB.CommandButton cmdExit
Caption = "退出"
Height = 375
Left = 4920
TabIndex = 0
Top = 3720
Width = 1095
End
Begin VB.Label record_counts
BackColor = &H00C0FFC0&
BackStyle = 0 'Transparent
Caption = "Label10"
Height = 375
Left = 3720
TabIndex = 27
Top = 2520
Width = 2775
End
Begin VB.Label Label9
Alignment = 1 'Right Justify
BackColor = &H00C0FFC0&
BackStyle = 0 'Transparent
Caption = "行始日期:"
Height = 255
Left = 120
TabIndex = 26
Top = 2640
Width = 1095
End
Begin VB.Label Label1
Alignment = 1 'Right Justify
BackColor = &H00C0FFC0&
BackStyle = 0 'Transparent
Caption = "客户号:"
Height = 255
Left = 360
TabIndex = 25
Top = 240
Width = 855
End
Begin VB.Label Label2
Alignment = 1 'Right Justify
BackColor = &H00C0FFC0&
BackStyle = 0 'Transparent
Caption = "客户名:"
Height = 255
Left = 3960
TabIndex = 24
Top = 240
Width = 855
End
Begin VB.Label Label3
Alignment = 1 'Right Justify
BackColor = &H00C0FFC0&
BackStyle = 0 'Transparent
Caption = "住址:"
Height = 255
Left = 600
TabIndex = 23
Top = 840
Width = 615
End
Begin VB.Label Label4
Alignment = 1 'Right Justify
BackColor = &H00C0FFC0&
BackStyle = 0 'Transparent
Caption = "电话:"
Height = 255
Left = 4200
TabIndex = 22
Top = 840
Width = 615
End
Begin VB.Label Label5
Alignment = 1 'Right Justify
BackColor = &H00C0FFC0&
BackStyle = 0 'Transparent
Caption = "电子邮件:"
Height = 255
Left = 120
TabIndex = 21
Top = 1440
Width = 1095
End
Begin VB.Label Label6
Alignment = 1 'Right Justify
BackColor = &H00C0FFC0&
BackStyle = 0 'Transparent
Caption = "人数:"
Height = 255
Left = 4200
TabIndex = 20
Top = 1440
Width = 615
End
Begin VB.Label Label7
Alignment = 1 'Right Justify
BackColor = &H00C0FFC0&
BackStyle = 0 'Transparent
Caption = "行程号:"
Height = 255
Left = 360
TabIndex = 19
Top = 2040
Width = 855
End
Begin VB.Label Label8
Alignment = 1 'Right Justify
BackColor = &H00C0FFC0&
BackStyle = 0 'Transparent
Caption = "业务员号:"
Height = 255
Left = 3720
TabIndex = 18
Top = 2040
Width = 1095
End
End
Attribute VB_Name = "OneFind"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim cnn As ADODB.Connection
Dim rs As ADODB.Recordset
Private Sub cmdExit_Click()
Unload OneFind
End Sub
Private Sub cmdFindOK_Click()
Dim str1 As String, str2 As String
Select Case FindCombo.Text
Case Is = "客户号"
str1 = "cust_cd= '" & Trim(Findtxt) & "'"
Case Is = "客户名"
str1 = "cust_nm= '" & Trim(Findtxt) & "'"
Case Else
str2 = "请按" + FindCombo.Text + "类型进行查询!"
MsgBox str2, , "警告"
Exit Sub
End Select
On Error GoTo err
rs.MoveFirst
rs.Find (str1)
If rs.EOF Then
MsgBox "没有查到满足条件的记录"
Else
Display
End If
Exit Sub
err:
MsgBox err.Description
End Sub
Private Sub FindCombo_Click()
Select Case Trim(FindCombo.Text)
Case Is = "客户号"
Findtxt.Text = "X"
Case Is = "客户名"
Findtxt.Text = ""
Case Else
End Select
End Sub
Private Sub Form_Load()
Set cnn = New ADODB.Connection
cnn.ConnectionString = "FILE NAME=" & App.Path & "\Tourist.udl"
cnn.Open
Set rs = New ADODB.Recordset
rs.CursorLocation = adUseClient
rs.Open "CUSTOMER", cnn, adOpenDynamic, adLockOptimistic, adCmdTable
OneFind.WindowState = 2
Display
Dim ctl As Control
For Each ctl In Controls
If TypeOf ctl Is TextBox Then
ctl.Enabled = False
End If
Next ctl
Findtxt.Enabled = True
End Sub
Private Sub Form_Unload(Cancel As Integer)
rs.Close
Set rs = Nothing
cnn.Close
Set cnn = Nothing
End Sub
Private Sub Display()
cust_cdtxt.Text = rs!cust_cd
cust_nmtxt.Text = rs!cust_nm
cust_addtxt.Text = rs!cust_add
tel_notxt.Text = rs!tel_no
e_mailtxt.Text = rs!e_mail
no_of_pertxt.Text = rs!no_of_per
cruise_cdtxt.Text = rs!cruise_cd
oper_cdtxt.Text = rs!oper_cd
start_dttxt.Text = rs!start_dt
If rs.RecordCount > 0 Then
record_counts.Caption = "当前记录:" + Str(rs.AbsolutePosition) + "/" + Str(rs.RecordCount)
Else
record_counts.Caption = "当前记录:0"
End If
End Sub
Private Sub cmdFirst_Click()
rs.MoveFirst
Display
End Sub
Private Sub cmdLast_Click()
rs.MoveLast
Display
End Sub
Private Sub cmdNext_Click()
With rs
.MoveNext
If .EOF Then .MoveLast
End With
Display
End Sub
Private Sub cmdPreviouse_Click()
With rs
.MovePrevious
If .BOF Then .MoveFirst
End With
Display
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -