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

📄 frmadd.frm

📁 ds学生学籍管理系统 有源代码等 是开发软件得好途径
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmAdd 
   Caption         =   "添加记录"
   ClientHeight    =   5535
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   6570
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   ScaleHeight     =   5535
   ScaleWidth      =   6570
   StartUpPosition =   3  '窗口缺省
   Begin VB.Data Data2 
      Caption         =   "Data2"
      Connect         =   "Access"
      DatabaseName    =   "E:\课程设计\学籍管理\Database\Server.mdb"
      DefaultCursorType=   0  '缺省游标
      DefaultType     =   2  '使用 ODBC
      Exclusive       =   0   'False
      Height          =   375
      Left            =   4560
      Options         =   0
      ReadOnly        =   0   'False
      RecordsetType   =   1  'Dynaset
      RecordSource    =   "Stu2"
      Top             =   240
      Visible         =   0   'False
      Width           =   1695
   End
   Begin VB.Data Data1 
      Caption         =   "Data1"
      Connect         =   "Access"
      DatabaseName    =   "E:\课程设计\学籍管理\Database\Server.mdb"
      DefaultCursorType=   0  '缺省游标
      DefaultType     =   2  '使用 ODBC
      Exclusive       =   0   'False
      Height          =   375
      Left            =   360
      Options         =   0
      ReadOnly        =   0   'False
      RecordsetType   =   1  'Dynaset
      RecordSource    =   "Stu1"
      Top             =   360
      Visible         =   0   'False
      Width           =   1695
   End
   Begin VB.CommandButton Command2 
      Caption         =   "取消"
      Height          =   375
      Left            =   3720
      TabIndex        =   16
      Top             =   4800
      Width           =   1215
   End
   Begin VB.CommandButton Command1 
      Caption         =   "添加记录"
      Height          =   375
      Left            =   1560
      TabIndex        =   15
      Top             =   4800
      Width           =   1215
   End
   Begin VB.TextBox Text1 
      Height          =   375
      Left            =   1200
      TabIndex        =   0
      Top             =   1200
      Width           =   1215
   End
   Begin VB.TextBox Text2 
      Height          =   375
      Left            =   3960
      TabIndex        =   1
      Top             =   1200
      Width           =   1215
   End
   Begin VB.TextBox Text3 
      Height          =   375
      Left            =   1200
      TabIndex        =   2
      Top             =   2160
      Width           =   1935
   End
   Begin VB.TextBox Text4 
      Height          =   375
      Left            =   3960
      TabIndex        =   3
      Top             =   2160
      Width           =   1215
   End
   Begin VB.TextBox Text5 
      Height          =   375
      Left            =   1200
      TabIndex        =   4
      Top             =   3000
      Width           =   1935
   End
   Begin VB.TextBox Text6 
      Height          =   375
      Left            =   3960
      TabIndex        =   5
      Top             =   3000
      Width           =   1215
   End
   Begin VB.TextBox Text7 
      Height          =   375
      Left            =   1680
      TabIndex        =   7
      Top             =   3960
      Width           =   3975
   End
   Begin VB.Label Label1 
      BackStyle       =   0  'Transparent
      Caption         =   "添加学生记录"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   15.75
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FF0000&
      Height          =   375
      Left            =   2280
      TabIndex        =   14
      Top             =   480
      Width           =   2175
   End
   Begin VB.Label Label2 
      Caption         =   "学号:"
      Height          =   255
      Left            =   600
      TabIndex        =   13
      Top             =   1320
      Width           =   615
   End
   Begin VB.Label Label3 
      Caption         =   "姓名:"
      Height          =   255
      Left            =   3240
      TabIndex        =   12
      Top             =   1320
      Width           =   495
   End
   Begin VB.Label Label4 
      Caption         =   "班级:"
      Height          =   255
      Left            =   600
      TabIndex        =   11
      Top             =   2280
      Width           =   495
   End
   Begin VB.Label Label5 
      Caption         =   "性别:"
      Height          =   255
      Left            =   3360
      TabIndex        =   10
      Top             =   2280
      Width           =   495
   End
   Begin VB.Label Label6 
      Caption         =   "电话:"
      Height          =   255
      Left            =   600
      TabIndex        =   9
      Top             =   3120
      Width           =   495
   End
   Begin VB.Label Label7 
      Caption         =   "学分:"
      Height          =   255
      Left            =   3360
      TabIndex        =   8
      Top             =   3120
      Width           =   495
   End
   Begin VB.Label Label8 
      Caption         =   "家庭住址:"
      Height          =   255
      Left            =   600
      TabIndex        =   6
      Top             =   4080
      Width           =   855
   End
End
Attribute VB_Name = "frmAdd"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
  Dim StrId As String
  StrId = Me.Text1.Text
  Me.Data1.Recordset.FindFirst "StuId=" & "'" & StrId & "'"
  If Me.Data1.Recordset.NoMatch Then
    Me.Data1.Recordset.AddNew
    Me.Data2.Recordset.AddNew
    Me.Data1.Recordset.Fields("StuId").Value = StrId
    Me.Data2.Recordset.Fields("StuId").Value = StrId
    Me.Data1.Recordset.Fields("StuName").Value = Me.Text2.Text
    Me.Data1.Recordset.Fields("StuClass").Value = Me.Text3.Text
    Me.Data1.Recordset.Fields("StuSex").Value = Me.Text4.Text
    Me.Data2.Recordset.Fields("StuPhone").Value = Me.Text5.Text
    Me.Data1.Recordset.Fields("StuScore").Value = Me.Text6.Text
    Me.Data2.Recordset.Fields("StuAddress").Value = Me.Text7.Text
    Me.Data1.Recordset.Update
    Me.Data2.Recordset.Update
    MsgBox "添加学生记录成功!!!", vbOKOnly + vbInformation, "提示"
    frmMain.Data1.Refresh
    frmMain.Data2.Refresh
    Unload Me
  Else
    MsgBox "学生学号重复!!!", vbOKOnly + vbCritical, "提示"
    Me.Text1.Text = ""
  End If
End Sub

Private Sub Form_Load()
  Me.Data1.DatabaseName = VB.App.Path & "\Database\Server.mdb"
  Me.Data2.DatabaseName = VB.App.Path & "\Database\Server.mdb"
  Me.Command1.Enabled = False
End Sub

Private Sub Text1_Change()
  Me.Command1.Enabled = True
End Sub

⌨️ 快捷键说明

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