frmteabase.frm

来自「一款非常适合中小学教学任务不是很繁重的管理程序」· FRM 代码 · 共 635 行 · 第 1/2 页

FRM
635
字号
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "家庭电话"
      ForeColor       =   &H00004000&
      Height          =   195
      Left            =   2400
      TabIndex        =   9
      Top             =   3120
      Width           =   720
   End
   Begin VB.Label Label8 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "姓名"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00004000&
      Height          =   240
      Left            =   2520
      TabIndex        =   8
      Top             =   1200
      Width           =   360
   End
   Begin VB.Label Label7 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "性别*"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00004000&
      Height          =   240
      Left            =   2520
      TabIndex        =   7
      Top             =   1560
      Width           =   435
   End
   Begin VB.Label Label6 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "民族*"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00004000&
      Height          =   240
      Left            =   2520
      TabIndex        =   6
      Top             =   1920
      Width           =   435
   End
   Begin VB.Label Label5 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "出生日期"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00004000&
      Height          =   240
      Left            =   2340
      TabIndex        =   5
      Top             =   2280
      Width           =   720
   End
   Begin VB.Label Label4 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "政治面貌*"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00004000&
      Height          =   240
      Left            =   2400
      TabIndex        =   4
      Top             =   2640
      Width           =   795
   End
   Begin VB.Label Label3 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "籍贯"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00004000&
      Height          =   240
      Left            =   2520
      TabIndex        =   3
      Top             =   4680
      Width           =   360
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "编号(主键):"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00004000&
      Height          =   240
      Left            =   2505
      TabIndex        =   2
      Top             =   840
      Width           =   1125
   End
   Begin VB.Label Label1 
      BackStyle       =   0  'Transparent
      Caption         =   "教师基本情况"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   18
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   4680
      TabIndex        =   0
      Top             =   120
      Width           =   2295
   End
End
Attribute VB_Name = "frmTeaBase"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim strSql As String
Dim RS As ADODB.Recordset
Private Sub cmdAdd_Click()
'添加
On Error Resume Next
If Trim(txtNo.Text) <> "" Then
    strSql = "insert into 教师基本情况表 values("
    strSql = strSql & "'" & Trim(txtNo.Text) & "',"
    strSql = strSql & "'" & Trim(txtName.Text) & "',"
    strSql = strSql & "'" & Trim(cboSex.Text) & "',"
    strSql = strSql & "'" & cboRace.ListIndex + 1 & "',"
    strSql = strSql & "'" & Trim(txtDate.Text) & "',"
    strSql = strSql & "'" & cboGov.ListIndex + 1 & "',"
    strSql = strSql & "'" & Trim(txtPhone.Text) & "',"
    strSql = strSql & "'" & Trim(Me.txtEmail.Text) & "',"
    strSql = strSql & "'" & Trim(txtPlace.Text) & "',"
    strSql = strSql & "'" & txtCommand.Text & "',"
    strSql = strSql & "'" & cboStudy.ListIndex + 1 & "',"
    strSql = strSql & "'" & cboPost.ListIndex + 1 & "')"
    dbOperate strSql
Else
    MsgBox "主键不能为空", vbOKOnlyvbok + vbExclamation, "提示"
End If
End Sub

Private Sub cmdDel_Click()
'删除
On Error Resume Next
If Trim(txtNo.Text) <> "" Then
    strSql = "delete * from 教师基本情况表 where 编号='" & Trim(txtNo.Text) & "'"
    dbOperate strSql
Else
     MsgBox "主键不能为空", vbOKOnlyvbok + vbExclamation, "提示"
End If
End Sub

Private Sub cmdExit_Click()
Unload Me
End Sub
Private Sub cmdFind_Click()
'查找
On Error Resume Next
If Trim(txtNo.Text) <> "" Then
    strSql = "select * from 教师基本情况表 where 编号='" & Trim(txtNo.Text) & "'"
    Set RS = dbSelect(strSql)
    Call clearAll
    Me.txtNo.Text = RS.Fields(0)
    Me.txtName.Text = RS.Fields(1)
    Me.cboSex.Text = RS.Fields(2)
    Me.cboRace.ListIndex = RS.Fields(3) - 1
    Me.txtDate.Text = RS.Fields(4)
    Me.cboGov.ListIndex = RS.Fields(5) - 1
    Me.txtPhone.Text = RS.Fields(6)
    Me.txtEmail.Text = RS.Fields(7)
    Me.txtPlace.Text = RS.Fields(8)
    Me.txtCommand.Text = RS.Fields(9)
    Me.cboStudy.ListIndex = RS.Fields(10) - 1
    Me.cboPost.ListIndex = RS.Fields(11) - 1
    Set RS = Nothing
Else
     MsgBox "主键不能为空", vbOKOnlyvbok + vbExclamation, "提示"
End If
End Sub

Private Sub cmdModiy_Click()
'修改
On Error Resume Next
If Trim(txtNo.Text) <> "" Then
    strSql = "update 教师基本情况表 set "
    strSql = strSql & "姓名='" & Trim(txtName.Text) & "',"
    strSql = strSql & "性别='" & Trim(cboSex.Text) & "',"
    strSql = strSql & "民族编号='" & cboRace.ListIndex + 1 & "',"
    strSql = strSql & "出生日期='" & Trim(txtDate.Text) & "',"
    strSql = strSql & "政治面貌编号='" & cboGov.ListIndex + 1 & "',"
    strSql = strSql & "家庭电话='" & Trim(txtPhone.Text) & "',"
    strSql = strSql & "电子邮箱='" & Trim(Me.txtEmail.Text) & "',"
    strSql = strSql & "籍贯='" & Trim(txtPlace.Text) & "',"
    strSql = strSql & "备注='" & txtCommand.Text & "',"
    strSql = strSql & "学历编号='" & cboStudy.ListIndex + 1 & "',"
    strSql = strSql & "职称编号='" & cboPost.ListIndex + 1 & "'"
    strSql = strSql & " where 编号='" & Trim(txtNo.Text) & "'"
    dbOperate strSql
Else
    MsgBox "主键不能为空", vbOKOnlyvbok + vbExclamation, "提示"
End If
End Sub

Private Sub cmdPrint_Click()
MsgBox "暂未编码", vbOKCancel + vbExclamation, "抱歉!"
End Sub

Private Sub Form_Load()
'民族和政治面貌入库
On Error Resume Next
strSql = "select 名字 from 民族表"
Set RS = dbSelect(strSql)
While Not RS.EOF
    cboRace.AddItem RS.Fields(0)
    RS.MoveNext
Wend
strSql = "select 名字 from 政治面貌类型表"
Set RS = dbSelect(strSql)
While Not RS.EOF
    cboGov.AddItem RS.Fields(0)
    RS.MoveNext
Wend
strSql = "select 名字 from 学历类型表"
Set RS = dbSelect(strSql)
While Not RS.EOF
    cboStudy.AddItem RS.Fields(0)
    RS.MoveNext
Wend
strSql = "select 名字 from 职称类型表"
Set RS = dbSelect(strSql)
While Not RS.EOF
    cboPost.AddItem RS.Fields(0)
    RS.MoveNext
Wend
Me.cboGov.ListIndex = 0
Me.cboRace.ListIndex = 0
Me.cboSex.ListIndex = 0
Me.cboStudy.ListIndex = 0
Me.cboPost.ListIndex = 0
Set RS = Nothing
Me.WindowsXPC1.InitSubClassing
End Sub
Sub clearAll()
'清空所有数据
On Error Resume Next
    Me.txtNo.Text = ""
    Me.txtName.Text = ""
    Me.cboSex.ListIndex = 0
    Me.cboRace.ListIndex = 0
    Me.txtDate.Text = ""
    Me.cboGov.ListIndex = 0
    Me.txtPhone.Text = ""
    Me.txtEmail.Text = ""
    Me.txtPlace.Text = ""
    Me.txtCommand.Text = ""
    Me.cboStudy.ListIndex = 0
    Me.cboPost.ListIndex = 0
End Sub

⌨️ 快捷键说明

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