📄 frmclassg.frm
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "Msflxgrd.ocx"
Begin VB.Form frmClassG
BorderStyle = 1 'Fixed Single
Caption = "班级信息管理"
ClientHeight = 4785
ClientLeft = 45
ClientTop = 330
ClientWidth = 8445
Icon = "frmClassG.frx":0000
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 4785
ScaleWidth = 8445
Begin VB.CommandButton cmdNext
Caption = ">"
Enabled = 0 'False
Height = 375
Left = 7560
TabIndex = 20
ToolTipText = "下一条"
Top = 720
Width = 360
End
Begin VB.CommandButton cmdQuit
Caption = "关闭"
Height = 375
Left = 6840
TabIndex = 19
ToolTipText = "不保存关闭窗口"
Top = 4200
Width = 1455
End
Begin VB.CommandButton cmdSave
Caption = "保存"
Height = 375
Left = 6840
TabIndex = 18
ToolTipText = "保存班级信息改动"
Top = 3720
Width = 1455
End
Begin MSFlexGridLib.MSFlexGrid MsflxClass
Height = 1935
Left = 120
TabIndex = 17
Top = 120
Width = 6615
_ExtentX = 11668
_ExtentY = 3413
_Version = 393216
Rows = 3
Cols = 5
FixedRows = 2
FocusRect = 0
SelectionMode = 1
AllowUserResizing= 1
End
Begin VB.CommandButton cmdModi
Caption = "修改班级"
Enabled = 0 'False
Height = 375
Left = 6840
TabIndex = 5
ToolTipText = "修改班级信息"
Top = 1680
Width = 1455
End
Begin VB.Frame fraClassInfo
Caption = "班级信息维护"
Enabled = 0 'False
Height = 2415
Left = 120
TabIndex = 7
Top = 2160
Width = 6615
Begin VB.TextBox txtRemark
Height = 855
Left = 240
TabIndex = 16
Top = 1440
Width = 6135
End
Begin VB.TextBox txtEndDate
BeginProperty DataFormat
Type = 1
Format = "yyyy-M-d"
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 3
EndProperty
Height = 375
Left = 4560
TabIndex = 15
Top = 720
Width = 1815
End
Begin VB.TextBox txtBegDate
BeginProperty DataFormat
Type = 1
Format = "yyyy-M-d"
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 3
EndProperty
Height = 375
Left = 1200
TabIndex = 14
Top = 720
Width = 1815
End
Begin VB.TextBox txtClassNo
Height = 375
Left = 1200
TabIndex = 13
Top = 240
Width = 1815
End
Begin VB.Label Label4
Caption = "备注:"
Height = 255
Left = 240
TabIndex = 12
Top = 1200
Width = 735
End
Begin VB.Label Label3
Caption = "结束日期:"
Height = 255
Left = 3360
TabIndex = 11
Top = 840
Width = 975
End
Begin VB.Label Label2
Caption = "开班日期:"
Height = 375
Left = 240
TabIndex = 10
Top = 840
Width = 1095
End
Begin VB.Label Label1
Caption = "班级编号:"
Height = 255
Left = 240
TabIndex = 9
Top = 360
Width = 975
End
End
Begin VB.CommandButton cmdRetrieve
Caption = "检索班级"
Height = 375
Left = 6840
TabIndex = 0
ToolTipText = "检索所有班级信息"
Top = 120
Width = 1455
End
Begin VB.CommandButton cmdNew
Caption = "新增班级"
Enabled = 0 'False
Height = 375
Left = 6840
TabIndex = 6
ToolTipText = "添加班级"
Top = 2400
Width = 1455
End
Begin VB.CommandButton cmdDelete
Caption = "删除班级"
Enabled = 0 'False
Height = 375
Left = 6840
TabIndex = 4
ToolTipText = "删除班级"
Top = 1200
Width = 1455
End
Begin VB.CommandButton cmdAdd
Caption = "保存班级"
Enabled = 0 'False
Height = 375
Left = 6840
TabIndex = 8
ToolTipText = "保存班级信息维护中的内容到列表"
Top = 2880
Width = 1455
End
Begin VB.CommandButton cmdFirst
Caption = "<<"
Enabled = 0 'False
Height = 375
Left = 6840
TabIndex = 1
ToolTipText = "最前一条"
Top = 720
Width = 360
End
Begin VB.CommandButton cmdPrevious
Caption = "<"
Enabled = 0 'False
Height = 375
Left = 7200
TabIndex = 2
ToolTipText = "上一条"
Top = 720
Width = 360
End
Begin VB.CommandButton cmdLast
Caption = ">>"
Enabled = 0 'False
Height = 375
Left = 7920
TabIndex = 3
ToolTipText = "最后一条"
Top = 720
Width = 360
End
End
Attribute VB_Name = "frmClassG"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim IfSave As Boolean
Dim IfAdd As Boolean '是否按下 新增班级
Dim Pri1 As New ADODB.Recordset '判断是否有其他表引用此表主键
Dim Pri2 As New ADODB.Recordset
Private Sub cmdAdd_Click()
If txtClassNo <> "" Or txtBegDate <> "" Then
MsflxClass.Col = 1
MsflxClass.Text = txtClassNo
MsflxClass.Col = 2
MsflxClass.Text = txtBegDate
MsflxClass.Col = 3
MsflxClass.Text = txtEndDate
MsflxClass.Col = 4
MsflxClass.Text = txtRemark
IfSave = True
fraClassInfo.Enabled = False
txtClassNo.Enabled = False
cmdAdd.Enabled = False '只允许保存一次
Else
MsgBox "请输入完整信息....", vbCritical + vbOKOnly, "信息不完整"
txtClassNo.SetFocus
End If
End Sub
Private Sub cmdDelete_Click()
Dim I As Integer
On Error GoTo Err_Del
If MsgBox("您真的要删除吗?", vbInformation + vbYesNo, "删除班级") = vbYes Then
MsflxClass.Col = 1
Pri1.Filter = "classno='" & MsflxClass.Text & "'"
Pri2.Filter = "classno='" & MsflxClass.Text & "'"
If MsflxClass.Row > 1 And MsflxClass.Row < MsflxClass.Rows Then
If Pri1.EOF = True And Pri1.BOF = True And Pri2.EOF = True And Pri2.BOF = True Then
Rst.MoveFirst
Rst.Find "classno='" & MsflxClass.Text & "'", , adSearchForward
Rst.Delete
Rst.Update
If MsflxClass.Rows > 3 Then
MsflxClass.RemoveItem MsflxClass.Row
Else
MsflxClass.Row = 2
For I = 0 To 4
MsflxClass.Col = I
MsflxClass.Text = ""
Next I
End If
Else
MsgBox "在其他表中存在引用,删除失败", vbCritical + vbOKOnly, "删除数据失败"
End If
Else
If Pri1.EOF = True And Pri1.BOF = True And Pri2.EOF = True And Pri2.BOF = True Then
Rst.Find "classno=" & MsflxClass.Text
Rst.Delete
Rst.Update
MsflxClass.Row = MsflxClass.Rows - 1
MsflxClass.RemoveItem MsflxClass.Rows - 1
Else
MsgBox "在其他表中存在引用,删除失败", vbCritical + vbOKOnly, "删除数据失败"
End If
End If
Exit Sub
End If
Err_Del:
If Err.Number = 30015 Then
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -