📄 form3.frm
字号:
VERSION 5.00
Object = "{00028C01-0000-0000-0000-000000000046}#1.0#0"; "DBGRID32.OCX"
Begin VB.Form Form3
Caption = "配置表"
ClientHeight = 5610
ClientLeft = 60
ClientTop = 345
ClientWidth = 8070
Icon = "Form3.frx":0000
LinkTopic = "Form3"
LockControls = -1 'True
ScaleHeight = 5610
ScaleWidth = 8070
StartUpPosition = 1 '所有者中心
Begin VB.CommandButton Command3
Caption = "删除一项岗位名称"
Height = 495
Left = 5520
TabIndex = 6
Top = 4920
Width = 975
End
Begin VB.CommandButton Command1
Caption = "删除一项部门名称"
Height = 495
Left = 1200
TabIndex = 5
Top = 4920
Width = 975
End
Begin VB.Data Data2
Caption = "Data2"
Connect = "Access"
DatabaseName = ""
DefaultCursorType= 0 '缺省游标
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 405
Left = 6120
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = ""
Top = 4320
Visible = 0 'False
Width = 1935
End
Begin VB.Data Data1
Caption = "Data1"
Connect = "Access"
DatabaseName = "E:\郭小龙论文\gxl\mang.mdb"
DefaultCursorType= 0 '缺省游标
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 375
Left = 120
Negotiate = -1 'True
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = ""
Top = 4680
Visible = 0 'False
Width = 1860
End
Begin VB.CommandButton Command2
Caption = "完成"
Height = 375
Left = 3360
TabIndex = 2
Top = 5040
Width = 1095
End
Begin VB.Frame Frame2
Caption = " 岗位名称配置 "
ForeColor = &H00FF0000&
Height = 4335
Left = 4320
TabIndex = 1
Top = 360
Width = 3135
Begin MSDBGrid.DBGrid DBGrid2
Bindings = "Form3.frx":08CA
Height = 3855
Left = 240
OleObjectBlob = "Form3.frx":08DE
TabIndex = 4
Top = 480
Width = 2655
End
End
Begin VB.Frame Frame1
Caption = " 部门名称配置 "
ForeColor = &H00FF0000&
Height = 4335
Left = 600
TabIndex = 0
Top = 360
Width = 3135
Begin MSDBGrid.DBGrid DBGrid1
Bindings = "Form3.frx":12B1
Height = 3855
Left = 240
OleObjectBlob = "Form3.frx":12C5
TabIndex = 3
Top = 480
Width = 2655
End
End
Begin VB.Label Label1
Alignment = 2 'Center
Caption = "增加及修改请直接在栏目中进行。"
Height = 3375
Left = 3960
TabIndex = 7
Top = 840
Width = 255
End
End
Attribute VB_Name = "Form3"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Form3.Data1.Recordset.FindFirst "部门名称 ='" & DBGrid1.Text & "'"
Select Case Data1.Recordset.RecordCount
Case 1 '如果只有一条记录,则在删除后使“删除”键消失
Data1.Recordset.Delete
Command7.Visible = False
Case Is > 1 '如果多于一条记录
Data1.Recordset.Delete
If Data1.Recordset.EOF Then '如果指针在最后一条记录
'!该判断有问题,当删除指针指向的最下方记录后,dbgrid中看不到指针。但不影响功能!
Data1.Recordset.MovePrevious '指针向前移动
Else: Data1.Recordset.MoveNext '否则向后移动
End If
End Select
End Sub
Private Sub Command2_Click()
Unload Form3
End Sub
Private Sub Command3_Click()
Form3.Data2.Recordset.FindFirst "岗位名称 ='" & DBGrid2.Text & "'"
Select Case Data2.Recordset.RecordCount
Case 1 '如果只有一条记录,则在删除后使“删除”键消失
Data2.Recordset.Delete
Command7.Visible = False
Case Is > 1 '如果多于一条记录
Data2.Recordset.Delete
If Data2.Recordset.EOF Then '如果指针在最后一条记录
'!该判断有问题,当删除指针指向的最下方记录后,dbgrid中看不到指针。但不影响功能!
Data2.Recordset.MovePrevious '指针向前移动
Else: Data2.Recordset.MoveNext '否则向后移动
End If
End Select
End Sub
Private Sub Form_Load()
Data1.DatabaseName = App.Path & "\mang.mdb"
Data1.RecordSource = "dep"
Data2.DatabaseName = App.Path & "\mang.mdb"
Data2.RecordSource = "func"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -