📄 frm_cx.frm
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form frm_cx
AutoRedraw = -1 'True
BorderStyle = 3 'Fixed Dialog
Caption = "查询"
ClientHeight = 4575
ClientLeft = 45
ClientTop = 330
ClientWidth = 6105
Icon = "frm_cx.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4575
ScaleWidth = 6105
ShowInTaskbar = 0 'False
StartUpPosition = 1 '所有者中心
Begin VB.Data Data1
Caption = "Data1"
Connect = "Access"
DatabaseName = "db.mdb"
DefaultCursorType= 0 '缺省游标
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 285
Left = 2160
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = "员工表"
Top = 3600
Visible = 0 'False
Width = 1140
End
Begin MSFlexGridLib.MSFlexGrid MSFlexGrid1
Bindings = "frm_cx.frx":0442
Height = 2415
Left = 120
TabIndex = 6
Top = 960
Width = 5775
_ExtentX = 10186
_ExtentY = 4260
_Version = 393216
FixedCols = 0
BackColor = 65535
SelectionMode = 1
AllowUserResizing= 3
End
Begin VB.CommandButton Command2
Caption = "返回"
Height = 495
Left = 4320
TabIndex = 5
Top = 3720
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "查询"
Height = 495
Left = 465
TabIndex = 4
Top = 3720
Width = 1215
End
Begin VB.TextBox Text2
Height = 375
Left = 4320
TabIndex = 1
Top = 240
Width = 1335
End
Begin VB.TextBox Text1
Height = 375
Left = 960
TabIndex = 0
Top = 240
Width = 1335
End
Begin VB.Label Label2
Caption = "姓名"
Height = 375
Left = 3480
TabIndex = 3
Top = 240
Width = 615
End
Begin VB.Label Label1
Caption = "工号"
Height = 375
Left = 120
TabIndex = 2
Top = 240
Width = 615
End
End
Attribute VB_Name = "frm_cx"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
If Text1.Text <> "" Then
For i = 1 To Len(Text1.Text)
If Asc(Mid(Text1.Text, i, 1)) < 48 Or Asc(Mid(Text1.Text, i, 1)) > 57 Then
MsgBox "工号输入数据不合法!请输入数字!", vbCritical
Exit Sub
End If
Next
Data1.RecordSource = "select * from 员工表 where 工号=" + Text1.Text + ""
Data1.Refresh
If Data1.Recordset.RecordCount > 0 Then
Text2.Text = Data1.Recordset.Fields("姓名")
Else
MsgBox "没有这条记录!", vbCritical
Text1.Text = ""
End If
ElseIf Text2.Text <> "" Then
Data1.RecordSource = "select * from 员工表 where 姓名='" + Text2.Text + "'"
Data1.Refresh
If Data1.Recordset.RecordCount > 0 Then
Text1.Text = Data1.Recordset.Fields("工号")
Else
MsgBox "没有这条记录!", vbCritical
Text2.Text = ""
End If
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Text1_Change()
Text2.Text = ""
End Sub
Private Sub Text2_Change()
Text1.Text = ""
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -