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

📄 frmaddacc.frm

📁 数据库课程设计
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmAddAcc 
   Caption         =   "添加配件"
   ClientHeight    =   3570
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   5295
   LinkTopic       =   "Form1"
   ScaleHeight     =   3570
   ScaleWidth      =   5295
   StartUpPosition =   3  'Windows Default
   Begin VB.CommandButton cmdCancel 
      Caption         =   "返回(&C)"
      Height          =   375
      Left            =   2760
      TabIndex        =   14
      Top             =   3000
      Width           =   1335
   End
   Begin VB.CommandButton cmdAdd 
      Caption         =   "添加(&A)"
      Height          =   375
      Left            =   1080
      TabIndex        =   13
      Top             =   3000
      Width           =   1335
   End
   Begin VB.Frame Frame1 
      Caption         =   "配件信息"
      Height          =   2655
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   5055
      Begin VB.TextBox txtAcc 
         Height          =   615
         Index           =   5
         Left            =   840
         TabIndex        =   12
         Text            =   "Text6"
         Top             =   1800
         Width           =   3855
      End
      Begin VB.TextBox txtAcc 
         Height          =   285
         Index           =   4
         Left            =   840
         TabIndex        =   11
         Text            =   "Text5"
         Top             =   1320
         Width           =   3855
      End
      Begin VB.TextBox txtAcc 
         Height          =   285
         Index           =   3
         Left            =   3000
         TabIndex        =   10
         Text            =   "Text4"
         Top             =   840
         Width           =   1695
      End
      Begin VB.TextBox txtAcc 
         Height          =   285
         Index           =   2
         Left            =   840
         TabIndex        =   9
         Text            =   "Text3"
         Top             =   840
         Width           =   1335
      End
      Begin VB.TextBox txtAcc 
         Height          =   285
         Index           =   1
         Left            =   3000
         TabIndex        =   8
         Text            =   "Text2"
         Top             =   360
         Width           =   1695
      End
      Begin VB.TextBox txtAcc 
         Height          =   285
         Index           =   0
         Left            =   840
         TabIndex        =   7
         Text            =   "Text1"
         Top             =   360
         Width           =   1335
      End
      Begin VB.Label Label6 
         Caption         =   "厂家:"
         Height          =   255
         Left            =   360
         TabIndex        =   6
         Top             =   1320
         Width           =   975
      End
      Begin VB.Label Label5 
         Caption         =   "备注:"
         Height          =   255
         Left            =   360
         TabIndex        =   5
         Top             =   1800
         Width           =   975
      End
      Begin VB.Label Label4 
         Caption         =   "数量:"
         Height          =   255
         Left            =   2520
         TabIndex        =   4
         Top             =   840
         Width           =   615
      End
      Begin VB.Label Label3 
         Caption         =   "价格:"
         Height          =   255
         Left            =   360
         TabIndex        =   3
         Top             =   840
         Width           =   615
      End
      Begin VB.Label Label2 
         Caption         =   "编号:"
         Height          =   255
         Left            =   2520
         TabIndex        =   2
         Top             =   360
         Width           =   1215
      End
      Begin VB.Label Label1 
         Caption         =   "名称:"
         Height          =   375
         Left            =   360
         TabIndex        =   1
         Top             =   360
         Width           =   1215
      End
   End
End
Attribute VB_Name = "frmAddAcc"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Public sqlStr As String
Public msgText As String

Private Sub cmdAdd_Click()
 Dim rstAccessory As ADODB.Recordset
 Dim i As Integer
  
 For i = 0 To 4
    If txtAcc(i).Text = "" Then
    
       MsgBox "请将信息填写完整", vbOKOnly + vbExclamation, "警告"
 
       Exit Sub
    
    End If
 Next i

 '添加新记录
 sqlStr = "select * from accessories"
 Set rstAccessory = ExecuteSQL(sqlStr, msgText)
 rstAccessory.AddNew
 rstAccessory.Fields("accName") = txtAcc(0).Text
 rstAccessory.Fields("accNo") = txtAcc(1).Text
 rstAccessory.Fields("accPrice") = txtAcc(2).Text
 rstAccessory.Fields("accStock") = txtAcc(3).Text
 rstAccessory.Fields("producer") = txtAcc(4).Text
 rstAccessory.Fields("memo") = txtAcc(5).Text
 rstAccessory.Update
 rstAccessory.Close
     
 MsgBox "配件信息添加完成!", vbOKOnly + vbExclamation, "警告"
 
 initTextBox

End Sub

Private Sub cmdCancel_Click()
Unload Me
End Sub

Private Sub Form_Load()

'窗体居中显示
Me.Top = (Screen.Height - Me.Height) \ 2
Me.Left = (Screen.Width - Me.Width) \ 2

initTextBox
End Sub


Sub initTextBox()
Dim i As Integer
For i = 0 To 5
    txtAcc(i) = ""
Next i
End Sub

⌨️ 快捷键说明

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