📄 部门信息查询.frm
字号:
VERSION 5.00
Begin VB.Form Form15
Caption = "Form15"
ClientHeight = 1770
ClientLeft = 60
ClientTop = 420
ClientWidth = 3915
LinkTopic = "Form15"
ScaleHeight = 1770
ScaleWidth = 3915
StartUpPosition = 3 '窗口缺省
Begin VB.TextBox Text1
Height = 375
Left = 240
TabIndex = 0
Top = 600
Width = 3015
End
Begin VB.CommandButton Command1
Caption = "查 询"
Height = 375
Left = 1080
TabIndex = 1
Top = 1200
Width = 855
End
Begin VB.CommandButton Command2
Caption = "取 消"
Height = 375
Left = 2160
TabIndex = 2
Top = 1200
Width = 855
End
Begin VB.Label Label1
Caption = "请输入你要查询部门的部门号:"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 240
TabIndex = 3
Top = 240
Width = 2775
End
End
Attribute VB_Name = "Form15"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim rst As New ADODB.Recordset '定义Recordset对象
Dim strSql As String
Private Sub Command1_Click()
Dim i As Integer
If Text1.Text = "" Then
i = MsgBox("请输入要查询的部门的部门号!", vbInformation + vbOKCancel + vbApplicationModal, "提示")
If i = 1 Then
Unload Me
Form15.Show
Else
Unload Me
Form6.Show
End If
Else
On Error GoTo err1
If rst.State = adStateOpen Then
rst.Close
End If
If IsNumeric(Text1.Text) = False Then
MsgBox "部门号必须是数值!请重新输入!", vbInformation + vbOKOnly + vbApplicationModal, "提示"
Text1.Text = ""
Text1.SetFocus
Exit Sub
End If
strSql = "select bmxx.部门号,bmxx.部门名称,bmxx.部门电话,bmxx.部门办公处 from bmxx where bmxx.部门号='" & Trim(Text1.Text) & "'"
rst.Open strSql, cnn, 1, 1
If rst.State = 1 Then
rst.Close
End If
rst.Open "select * from bmxx where 部门号='" & Text1.Text & "'", cnn, 1, 1
Set Form6.DataGrid1.DataSource = rst
Call fillrsinfo3
Unload Me
Form16.Show
err1:
If Err.Number = 6160 Then
MsgBox "没有这个部门,请重新输入!", vbInformation + vbOKOnly + vbApplicationModal, "提示"
Text1.SetFocus
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
Else
Exit Sub
End If
End If
End Sub
Private Sub Command2_Click()
Unload Me
Form6.Show
End Sub
Public Sub fillrsinfo3()
Form16.Text1.Text = Trim(Form6.DataGrid1.Columns("部门号"))
Form16.Text2.Text = Trim(Form6.DataGrid1.Columns("部门名称"))
Form16.Text3.Text = Trim(Form6.DataGrid1.Columns("部门电话"))
Form16.Text4.Text = Trim(Form6.DataGrid1.Columns("部门办公处"))
End Sub
Private Sub Form_Load()
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -