📄 frmmeeting.frm
字号:
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form frmMeeting
BorderStyle = 3 'Fixed Dialog
Caption = "新会议录入"
ClientHeight = 5565
ClientLeft = 45
ClientTop = 330
ClientWidth = 6255
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 5565
ScaleWidth = 6255
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin VB.PictureBox Picture1
Height = 4575
Left = 120
ScaleHeight = 4515
ScaleWidth = 5955
TabIndex = 2
Top = 120
Width = 6015
Begin VB.TextBox txtTopic
Appearance = 0 'Flat
Height = 330
Left = 1080
TabIndex = 8
Top = 240
Width = 4695
End
Begin VB.ComboBox Combo_master
Height = 300
Left = 1080
Style = 2 'Dropdown List
TabIndex = 7
Top = 1095
Width = 1695
End
Begin VB.ComboBox Combo_Pri
Height = 300
Left = 4080
Style = 2 'Dropdown List
TabIndex = 6
Top = 675
Width = 1695
End
Begin VB.TextBox txtContent
Appearance = 0 'Flat
Height = 2370
Left = 1080
MultiLine = -1 'True
ScrollBars = 3 'Both
TabIndex = 5
Top = 1950
Width = 4695
End
Begin VB.TextBox txtPeople
Appearance = 0 'Flat
Height = 330
Left = 1080
TabIndex = 4
Top = 1530
Width = 4695
End
Begin MSComCtl2.DTPicker DTPicker1
Height = 330
Left = 1080
TabIndex = 3
Top = 660
Width = 1695
_ExtentX = 2990
_ExtentY = 582
_Version = 393216
Format = 26935296
CurrentDate = 38025
End
Begin VB.Label Label6
AutoSize = -1 'True
Caption = "重要性"
Height = 180
Left = 3435
TabIndex = 14
Top = 735
Width = 540
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "会议内容"
Height = 180
Left = 240
TabIndex = 13
Top = 2070
Width = 720
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "相关人员"
Height = 180
Left = 240
TabIndex = 12
Top = 1605
Width = 720
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "主持人"
Height = 180
Left = 240
TabIndex = 11
Top = 1155
Width = 540
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "开会日期"
Height = 180
Left = 240
TabIndex = 10
Top = 735
Width = 720
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "会议主题"
Height = 180
Left = 240
TabIndex = 9
Top = 315
Width = 720
End
End
Begin VB.CommandButton cmdCancel
Height = 495
Left = 3600
Picture = "frmMeeting.frx":0000
Style = 1 'Graphical
TabIndex = 1
Top = 4920
Width = 1215
End
Begin VB.CommandButton cmdOK
Height = 495
Left = 1320
Picture = "frmMeeting.frx":0552
Style = 1 'Graphical
TabIndex = 0
Top = 4920
Width = 1215
End
End
Attribute VB_Name = "frmMeeting"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub cmdOK_Click()
Dim strsql As String
Dim rst As New ADODB.Recordset
Dim strsql2 As String
Dim rst2 As New ADODB.Recordset
If Me.txtTopic = "" Then '必须有会议主题
MsgBox "填写会议主题", vbCritical, Me.Caption
Exit Sub
End If
If Me.Combo_Pri.Text = "" Then '确定重要性
MsgBox "选定重要性级别", vbCritical, Me.Caption
Exit Sub
End If
If Me.Combo_master.Text = "" Then '必须添主持人
MsgBox "选定主持人", vbCritical, Me.Caption
Exit Sub
End If
If Me.txtPeople.Text = "" Then '要填写参与者
MsgBox "请写入参与人员", vbCritical, Me.Caption
Exit Sub
End If
If Me.txtContent = "" Then '会议内容不能空
MsgBox "会议内容不能空", vbCritical, Me.Caption
Exit Sub
End If
strsql = "select * from tbl_meeting where topic='" & _
Me.txtTopic & "'" '查找以往会议题目
rst.Open strsql, CnnDataBase, adOpenStatic, adLockOptimistic
If rst.RecordCount > 0 Then '以往存在重复题目
MsgBox "会议题目已存在,请修改!", vbCritical, Me.Caption
Exit Sub
End If
strsql2 = "select * from tbl_master where mastername='" & Me.Combo_master & "'"
rst2.Open strsql2, CnnDataBase, adOpenStatic '得到主持人编号
If rst2.RecordCount <> 1 Then
MsgBox "主持人数据库表中人名重复!", vbCritical, Me.Caption
Exit Sub
End If
rst.AddNew '增加新记录
rst!topic = Me.txtTopic
rst!Date = Me.DTPicker1.Value
rst!Primary = Me.Combo_Pri.Text
rst!master = rst2!masterid
rst!People = Me.txtPeople
rst!Content = Me.txtContent
rst.Update '添加记录结束
MsgBox "新记录添加成功!", vbInformation, Me.Caption
rst2.Close '关闭所有记录集
rst.Close
Me.txtTopic = "" '主题栏置空
Me.txtPeople = "" '相关人员置空
Me.txtContent = "" '会议内容置空
Me.DTPicker1.Value = Date '日期设为当日
Me.Combo_master.ListIndex = -1 '主持人置空
Me.Combo_Pri.ListIndex = -1 '重要性置空
End Sub
Private Sub Form_Load()
Dim strsql As String
Dim rst As New ADODB.Recordset
strsql = "select mastername from tbl_master order by masterid"
rst.Open strsql, CnnDataBase '打开数据集
With Me.Combo_master '添加“主持人”
Do While rst.EOF = False
.AddItem rst!MasterName
rst.MoveNext
Loop
.ListIndex = -1 '默认选择空
End With
With Me.Combo_Pri '添加“重要性”
.AddItem "最高"
.AddItem "高"
.AddItem "一般"
.AddItem "低"
.AddItem "最低"
.ListIndex = -1 '默认选择空
End With
Me.txtTopic = "" '主题栏置空
Me.txtPeople = "" '相关人员置空
Me.txtContent = "" '会议内容置空
Me.DTPicker1.Value = Date '日期设为当日
End Sub
Private Sub Form_Unload(Cancel As Integer)
Dim strsql As String
Dim rst As New ADODB.Recordset
Dim strsql2 As String
Dim rst2 As New ADODB.Recordset
strsql = "select * from tbl_meeting order by id"
rst.Open strsql, CnnDataBase '打开数据库的记录集
With frmMain.MSFmeeting
.Rows = 1 '刷新主窗体中MSFlexGrid的内容
Do While rst.EOF = False
.Rows = .Rows + 1 '增加MSFlex一行空行
.Row = .Rows - 1
.TextMatrix(.Row, 0) = rst!topic '向新空行添加记录
.TextMatrix(.Row, 1) = rst!Date
.TextMatrix(.Row, 2) = rst!Primary
strsql2 = "select * from tbl_master where masterid=" & rst!master
rst2.Open strsql2, CnnDataBase, adOpenStatic
If rst2.RecordCount <> 1 Then '查找对应的主持人名
MsgBox "会议主持人数据表中有重复!", vbCritical, "数据库错误"
Exit Sub
End If
.TextMatrix(.Row, 3) = rst2!MasterName
rst2.Close
.TextMatrix(.Row, 4) = rst!People
.TextMatrix(.Row, 5) = rst!Content
rst.MoveNext
Loop
.Row = 0 '设置MSFlex默认指向固定行
End With
rst.Close
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -