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

📄 addcd.frm

📁 VB+ACCESS2000编写的VCD出租管理系统
💻 FRM
字号:
VERSION 5.00
Begin VB.Form AddCD 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "添加影碟"
   ClientHeight    =   2820
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   7500
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   ScaleHeight     =   2820
   ScaleWidth      =   7500
   Begin VB.CommandButton Command2 
      Caption         =   "关闭(&C)"
      Height          =   375
      Left            =   6000
      TabIndex        =   14
      Top             =   2280
      Width           =   1335
   End
   Begin VB.CommandButton Command1 
      Caption         =   "添加(&A)"
      Height          =   375
      Left            =   4440
      TabIndex        =   13
      Top             =   2280
      Width           =   1455
   End
   Begin VB.TextBox Text1 
      Appearance      =   0  'Flat
      BackColor       =   &H0080FFFF&
      Enabled         =   0   'False
      Height          =   375
      Index           =   4
      Left            =   5160
      TabIndex        =   12
      Top             =   1560
      Width           =   1695
   End
   Begin VB.TextBox Text1 
      Appearance      =   0  'Flat
      Height          =   375
      Index           =   3
      Left            =   1320
      TabIndex        =   10
      Top             =   1560
      Width           =   1695
   End
   Begin VB.TextBox Text1 
      Appearance      =   0  'Flat
      Height          =   375
      Index           =   1
      Left            =   5160
      TabIndex        =   4
      Top             =   360
      Width           =   1695
   End
   Begin VB.Frame Frame1 
      Caption         =   "影碟信息"
      Height          =   2055
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   7215
      Begin VB.ComboBox Combo1 
         Appearance      =   0  'Flat
         Height          =   300
         Left            =   5040
         TabIndex        =   8
         Top             =   840
         Width           =   1695
      End
      Begin VB.TextBox Text1 
         Appearance      =   0  'Flat
         Height          =   375
         Index           =   2
         Left            =   1200
         TabIndex        =   6
         Top             =   840
         Width           =   1695
      End
      Begin VB.TextBox Text1 
         Appearance      =   0  'Flat
         Height          =   375
         Index           =   0
         Left            =   1200
         TabIndex        =   2
         Top             =   240
         Width           =   1695
      End
      Begin VB.Label Label1 
         Caption         =   "登入时间:"
         Height          =   375
         Index           =   5
         Left            =   3960
         TabIndex        =   11
         Top             =   1560
         Width           =   975
      End
      Begin VB.Label Label1 
         Caption         =   "影碟类别:"
         Height          =   255
         Index           =   4
         Left            =   3960
         TabIndex        =   9
         Top             =   960
         Width           =   975
      End
      Begin VB.Label Label1 
         Caption         =   "光碟数量:"
         Height          =   255
         Index           =   3
         Left            =   240
         TabIndex        =   7
         Top             =   1560
         Width           =   975
      End
      Begin VB.Label Label1 
         Caption         =   "影碟价格:"
         Height          =   375
         Index           =   2
         Left            =   240
         TabIndex        =   5
         Top             =   960
         Width           =   975
      End
      Begin VB.Label Label1 
         Caption         =   "影碟名称:"
         Height          =   375
         Index           =   1
         Left            =   3960
         TabIndex        =   3
         Top             =   360
         Width           =   975
      End
      Begin VB.Label Label1 
         Caption         =   "影碟编号:"
         Height          =   255
         Index           =   0
         Left            =   240
         TabIndex        =   1
         Top             =   360
         Width           =   975
      End
   End
End
Attribute VB_Name = "AddCD"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub Combo1_Change()
Combo1.Text = ""
End Sub

Private Sub Command1_Click()
Dim SQL As String
Dim i As Integer
For i = 0 To 3
    If Text1(i) = "" Then
        MsgBox "对不起:" & Label1(i).Caption & "不能为空!", vbInformation + vbOKOnly, "警告"
        Text1(i).SetFocus
        Exit Sub
    End If
Next
If Combo1.Text = "" Then
    MsgBox "对不起:影碟类别:不能为空!", vbInformation + vbOKOnly, "警告"
    Combo1.SetFocus
    Exit Sub
End If

SQL = "select 影碟编号 from cdinfo where 影碟编号=""" & Text1(0).Text & """"
OpenDBFile
OpenRS (SQL)
If gRst.RecordCount > 0 Then
    gRst.MoveFirst
    If Not gRst.EOF Then
       MsgBox "对不起,该编号已经使用过了,请重新输入编号!", vbInformation + vbOKOnly, "警告"
       Text1(0).Text = ""
       Text1(0).SetFocus
       CloseRS
       Exit Sub
    End If
End If
CloseRS

SQL = "select * from cdtype where 影碟类别=""" & CStr(Combo1.Text) & """"
OpenDBFile
OpenRS (SQL)
If Not gRst.BOF Then
   gRst.MoveFirst
End If
If gRst.EOF Then
     MsgBox "对不起,你输入的影碟类别不存在,请选择存在的影碟类别!", vbInformation + vbOKOnly, "警告"
     CloseRS
     Exit Sub
End If
CloseRS

SQL = "insert into cdinfo(影碟编号,影碟名称,影碟价格,光碟数量,借出次数,影碟类别,是否借出,入店时间)values(""" _
                          & Text1(0).Text & """,""" _
                          & Text1(1).Text & """," _
                          & Text1(2).Text & "," _
                          & Text1(3).Text & ",0,""" _
                          & Combo1.Text & """,NO,#" _
                          & Text1(4).Text & "#)"
OpenDBFile

gCon.Execute SQL

CloseDBFile
MsgBox "信息添加成功!", vbInformation + vbOKOnly, "提示"
For i = 0 To 3
    Text1(i).Text = ""
Next
Text1(0).SetFocus
End Sub

Private Sub Command2_Click()
Unload Me
End Sub

Private Sub Form_Load()
Dim SQL As String
Text1(4).Text = Date
SQL = "select 影碟类别 from cdtype "
OpenDBFile
OpenRS (SQL)
If gRst.RecordCount > 0 Then
   gRst.MoveFirst
   Do While Not gRst.EOF
       Combo1.AddItem gRst("影碟类别")
       gRst.MoveNext
    Loop
    CloseRS
Else
CloseRS
MsgBox "对不起,请先给影碟分类!", vbInformation + vbOKOnly, "提示"
CDtype.Show
Unload Me
End If
End Sub

⌨️ 快捷键说明

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