VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form frmAdd 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "添加影片"
   ClientHeight    =   3135
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   5400
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3135
   ScaleWidth      =   5400
   StartUpPosition =   2  '屏幕中心
   Begin VB.CommandButton cmdAddFilm 
      Caption         =   "添加"
      Height          =   375
      Left            =   2610
      TabIndex        =   13
      Top             =   2520
      Width           =   735
   End
   Begin VB.CommandButton cmdCancel 
      Caption         =   "取消"
      Height          =   375
      Left            =   4320
      TabIndex        =   12
      Top             =   2520
      Width           =   975
   End
   Begin VB.Frame Frame1 
      Caption         =   "编辑影片信息"
      Height          =   2175
      Left            =   240
      TabIndex        =   1
      Top             =   120
      Width           =   5055
      Begin VB.TextBox txtPath 
         Height          =   270
         Left            =   1200
         TabIndex        =   11
         Top             =   1680
         Width           =   3495
      End
      Begin VB.TextBox txtNum 
         DataField       =   "编号"
         DataSource      =   "Adodc1"
         Height          =   270
         Left            =   720
         TabIndex        =   5
         ToolTipText     =   "编号，不能有重复"
         Top             =   465
         Width           =   975
      End
      Begin VB.TextBox txtName 
         DataField       =   "名称"
         DataSource      =   "Adodc1"
         Height          =   270
         Left            =   720
         TabIndex        =   4
         Top             =   840
         Width           =   1695
      End
      Begin VB.TextBox txtTime 
         DataField       =   "上一次查看时间"
         DataSource      =   "Adodc1"
         Height          =   270
         Left            =   1080
         TabIndex        =   3
         Top             =   1200
         Width           =   1335
      End
      Begin VB.TextBox txtIntro 
         DataField       =   "影片说明"
         Height          =   975
         Left            =   2640
         MultiLine       =   -1  'True
         ScrollBars      =   2  'Vertical
         TabIndex        =   2
         Top             =   600
         Width           =   2175
      End
      Begin VB.Label Label5 
         Caption         =   "影片路径:"
         Height          =   255
         Left            =   240
         TabIndex        =   10
         Top             =   1680
         Width           =   975
      End
      Begin VB.Label Label1 
         Caption         =   "编号:"
         Height          =   255
         Left            =   240
         TabIndex        =   9
         Top             =   480
         Width           =   495
      End
      Begin VB.Label Label2 
         Caption         =   "片名:"
         Height          =   255
         Left            =   240
         TabIndex        =   8
         Top             =   840
         Width           =   495
      End
      Begin VB.Label Label3 
         Caption         =   "导入时间:"
         Height          =   255
         Left            =   240
         TabIndex        =   7
         Top             =   1200
         Width           =   855
      End
      Begin VB.Label Label4 
         Caption         =   "影片说明:"
         Height          =   255
         Left            =   2640
         TabIndex        =   6
         Top             =   240
         Width           =   1095
      End
   End
   Begin VB.CommandButton cmdAddPath 
      Caption         =   "导入路径..."
      Height          =   375
      Left            =   360
      TabIndex        =   0
      Top             =   2520
      Width           =   1215
   End
   Begin MSComDlg.CommonDialog CommonDialog1 
      Left            =   1920
      Top             =   2520
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
      Filter          =   $"frmAdd.frx":0000
   End
End
Attribute VB_Name = "frmAdd"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Form_Load()
    txtTime.Text = Date '设置为当前系统日期
    
End Sub

Private Sub cmdAddFilm_Click()
On Error GoTo ErrInput      '启动错误捕获
    With rsFilm             '设置以下语句块均为rsFilm对象的属性
        .AddNew             '添加新记录
            '为当前记录各字段赋值
        .Fields("编号") = Val(txtNum)   '将文本框字符串转换为数值并赋给当前记录
        .Fields("片名") = txtName.Text
        .Fields("存储路径") = txtPath.Text
            '将文本框字符串转换为日期并赋给当前记录
        .Fields("上次观看时间") = DateValue(txtTime.Text)
        .Fields("影片介绍") = txtIntro.Text
        .Update     '更新记录集
        
    End With    '结束对象语句块
    '使用对话框询问是否继续添加
    If MsgBox("一记录添加完成，继续添加？", vbYesNo) = vbYes Then
        txtNum.Text = ""
        txtName.Text = ""
        txtPath.Text = ""
        txtTime.Text = Date '设置为系统当前日期
        txtIntro.Text = ""
        txtNum.SetFocus     '设置焦点
    Else
        Unload Me
    End If
    Exit Sub
ErrInput:
    MsgBox "输入数据有误或与已有数据冲突！"
End Sub

Private Sub cmdAddPath_Click()
    CommonDialog1.ShowOpen   '显示打开文件对话框
    txtPath.Text = CommonDialog1.FileName   '获取文件路径
End Sub

Private Sub cmdCancel_Click()
    Unload Me
End Sub

Private Sub Form_Unload(Cancel As Integer)
    frmMain.Show
End Sub
