⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmeditinstitute.frm

📁 本系统是本着实用的原则开发的
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmAddInstitute 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "添加院系信息"
   ClientHeight    =   4395
   ClientLeft      =   5550
   ClientTop       =   2685
   ClientWidth     =   3690
   Icon            =   "frmEditInstitute.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   4395
   ScaleWidth      =   3690
   ShowInTaskbar   =   0   'False
   Begin VB.CommandButton cmdExit 
      Caption         =   "退 出"
      Height          =   375
      Left            =   2520
      TabIndex        =   8
      Top             =   3720
      Width           =   855
   End
   Begin VB.CommandButton cmdSave 
      Caption         =   "保 存"
      Height          =   375
      Left            =   1320
      TabIndex        =   7
      Top             =   3720
      Width           =   855
   End
   Begin VB.Frame FraInstitute 
      Caption         =   "院系信息"
      Height          =   3135
      Left            =   360
      TabIndex        =   0
      Top             =   360
      Width           =   3015
      Begin VB.TextBox txtI_Memo 
         Height          =   1215
         Left            =   360
         MultiLine       =   -1  'True
         ScrollBars      =   2  'Vertical
         TabIndex        =   6
         Top             =   1680
         Width           =   2295
      End
      Begin VB.TextBox txtI_Name 
         Height          =   270
         Left            =   1200
         MaxLength       =   10
         TabIndex        =   5
         Top             =   960
         Width           =   1455
      End
      Begin VB.TextBox txtI_ID 
         Height          =   270
         Left            =   1200
         MaxLength       =   2
         TabIndex        =   4
         Top             =   480
         Width           =   1455
      End
      Begin VB.Label lblI_Memo 
         AutoSize        =   -1  'True
         Caption         =   "院系描述:"
         Height          =   180
         Left            =   360
         TabIndex        =   3
         Top             =   1440
         Width           =   900
      End
      Begin VB.Label lblI_Name 
         AutoSize        =   -1  'True
         Caption         =   "院系名:"
         Height          =   180
         Left            =   360
         TabIndex        =   2
         Top             =   960
         Width           =   720
      End
      Begin VB.Label lblI_ID 
         AutoSize        =   -1  'True
         Caption         =   "院系ID:"
         Height          =   180
         Left            =   360
         TabIndex        =   1
         Top             =   480
         Width           =   720
      End
   End
End
Attribute VB_Name = "frmAddInstitute"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''                                                                ''
''Filename       frmAddInstitute.frm                              ''
''                                                                ''
''Created On     2004.2.6--2004.2.8                               ''
''                                                                ''
''Description    添加院系信息窗体                                 ''
''                                                                ''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Dim rsInstitute As Recordset
Dim rsLog As Recordset
Dim rsOperateLog As Recordset
Dim rsI_ID As Recordset
Dim rsI_Name As Recordset
Public StrI_Name As String
Private Sub cmdExit_Click()
Unload frmAddInstitute
End Sub
Private Sub cmdSave_Click()
If Judge = True Then
    If MsgBox("确实要保存吗?", vbYesNo + vbQuestion, "机房管理") = vbYes Then
        SaveInfo
        txtI_ID.Text = ""
        txtI_Name.Text = ""
        txtI_Memo.Text = ""
        txtI_ID.SetFocus
    End If
End If
End Sub
Private Sub Form_Load()
Set rsInstitute = New Recordset
Dim StrInstitute As String
StrInstitute = "select * from TbInstitute"
rsInstitute.Open StrInstitute, Modmain.conn, 3, 2
End Sub

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''只能输入数字                                                    ''
''按回车键时,跳到下一格                                          ''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Private Sub txtI_ID_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
    SendKeys "{tab}"
End If
Dim L As Boolean
    L = Chr(KeyAscii) Like "[0-9]" Or KeyAscii = 8
    If L = False Then
        KeyAscii = 0
    End If
End Sub

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''验证输入的院系ID是否已经存在,若存在则清空重新编写              ''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Sub txtI_ID_LostFocus()
Set rsI_ID = New Recordset
Dim strI_ID As String
strI_ID = "select * from TbInstitute where I_ID='" & txtI_ID.Text & "'"
rsI_ID.Open strI_ID, Modmain.conn, 3, 2
If rsI_ID.RecordCount <> 0 Then
    MsgBox "该院系ID已存在,请重新编写!", vbOKOnly + vbCritical, "机房管理"
    txtI_ID.Text = ""
    txtI_ID.SetFocus
End If
rsI_ID.Close
Set rsI_ID = Nothing
End Sub
Private Sub txtI_Name_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
    SendKeys "{tab}"
End If
End Sub

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''验证输入的院系名是否已经存在,若存在则清空重新编写              ''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Private Sub txtI_Name_LostFocus()
Set rsI_Name = New Recordset
Dim StrI_Name  As String
StrI_Name = "select * from TbInstitute where I_Name ='" & Trim(CStr(txtI_Name.Text)) & "'"
rsI_Name.Open StrI_Name, Modmain.conn, 3, 2
If rsI_Name.RecordCount <> 0 Then
    MsgBox "该院系名已存在,请重新编写!", vbOKOnly + vbCritical, "机房管理"
    txtI_Name.Text = ""
    txtI_Name.SetFocus
End If
rsI_Name.Close
Set rsI_Name = Nothing
End Sub


''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''保存新添加的院系信息                                            ''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Private Sub SaveInfo()
    rsInstitute.AddNew
    StrI_Name = txtI_Name.Text
    rsInstitute.Fields("I_ID") = txtI_ID.Text
    rsInstitute.Fields("I_Name") = Trim(CStr(txtI_Name.Text))
    If Trim(txtI_Memo.Text) <> "" Then
        rsInstitute.Fields("I_Memo") = Trim(txtI_Memo.Text)
    Else
        rsInstitute.Fields("I_Memo") = ""
    End If
    rsInstitute.Update
    
    AddLog
    MsgBox "保存成功", vbOKOnly + vbInformation, "机房管理"    '保存完毕并提醒
    frmInstitute.AddInstituteNodes
    
    'rsInstitute.Close
    'Set rsInstitute = Nothing
    
End Sub

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''验证输入的院系ID、院系名是否为空,若为空则重新添加              ''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Function Judge() As Boolean
If Trim(txtI_ID) = "" Then
    MsgBox "院系ID不能为空", vbOKOnly + vbExclamation, "机房管理"
    txtI_ID.SetFocus
    ElseIf Trim(txtI_Name) = "" Then
        MsgBox "院系名称不能为空", vbOKOnly + vbExclamation, "机房管理"
        txtI_Name.SetFocus
        Else
            Judge = True
End If
End Function

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''将用户添加院系的信息记入操作日志                                ''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Sub AddLog()
Dim strEvents As String
Dim strTemp As String
strTemp = "'"
Set rsOperateLog = New Recordset
rsOperateLog.Open "select * from tbOperateLog", Modmain.conn, 3, 2
Set rsLog = New Recordset
rsLog.Open "select * from tblog where L_ID='L01'", Modmain.conn, 3, 2
strEvents = rsLog.Fields!Events

rsOperateLog.AddNew
    rsOperateLog.Fields!U_ID = frmLoad.StrU_ID
    rsOperateLog.Fields!Time = Time
    rsOperateLog.Fields!Date = Date
    rsOperateLog.Fields!Events = strEvents
    rsOperateLog.Fields!Description = strEvents & strTemp & txtI_Name.Text & strTemp
rsOperateLog.Update
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -