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

📄 frmproadd.frm

📁 这是一个有VB开发的学院办公自动化系统
💻 FRM
字号:
VERSION 5.00
Begin VB.Form FrmProadd 
   BackColor       =   &H8000000D&
   BorderStyle     =   1  'Fixed Single
   Caption         =   "添加财产信息"
   ClientHeight    =   4710
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   6090
   Icon            =   "FrmProadd.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   ScaleHeight     =   4710
   ScaleWidth      =   6090
   Begin VB.TextBox txtbh 
      Height          =   330
      Left            =   1200
      TabIndex        =   19
      Top             =   240
      Width           =   1800
   End
   Begin VB.CommandButton Cmdcancle 
      Caption         =   "取消"
      Height          =   375
      Left            =   3600
      TabIndex        =   10
      Top             =   4080
      Width           =   1400
   End
   Begin VB.CommandButton Cmdok 
      Caption         =   "确定"
      Default         =   -1  'True
      Height          =   375
      Left            =   1080
      TabIndex        =   9
      Top             =   4080
      Width           =   1400
   End
   Begin VB.Frame Frame1 
      BackColor       =   &H8000000D&
      Height          =   3255
      Left            =   140
      TabIndex        =   0
      Top             =   600
      Width           =   5805
      Begin VB.ComboBox TxtOwner 
         Height          =   300
         Left            =   3700
         TabIndex        =   21
         Top             =   885
         Width           =   1800
      End
      Begin VB.CommandButton cmdcalendar 
         Height          =   375
         Left            =   5160
         Picture         =   "FrmProadd.frx":09CA
         Style           =   1  'Graphical
         TabIndex        =   20
         Top             =   1440
         Width           =   375
      End
      Begin VB.TextBox txtBeizhu 
         Height          =   975
         Left            =   800
         MultiLine       =   -1  'True
         ScrollBars      =   2  'Vertical
         TabIndex        =   8
         Top             =   2040
         Width           =   4750
      End
      Begin VB.TextBox txtRiqi 
         BeginProperty DataFormat 
            Type            =   1
            Format          =   "yyyy-MM-dd"
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   2052
            SubFormatType   =   3
         EndProperty
         Height          =   330
         Left            =   3700
         TabIndex        =   7
         Top             =   1440
         Width           =   1800
      End
      Begin VB.TextBox txtGuige 
         Height          =   330
         Left            =   800
         TabIndex        =   5
         Top             =   885
         Width           =   1800
      End
      Begin VB.TextBox txtType 
         Height          =   330
         Left            =   3700
         TabIndex        =   4
         Top             =   360
         Width           =   1800
      End
      Begin VB.TextBox txtName 
         Height          =   330
         Left            =   800
         TabIndex        =   3
         Top             =   360
         Width           =   1800
      End
      Begin VB.TextBox txttotal 
         Height          =   330
         Left            =   800
         TabIndex        =   6
         Top             =   1440
         Width           =   1800
      End
      Begin VB.CommandButton Command1 
         Caption         =   "确 定 参 加"
         Height          =   495
         Left            =   1080
         TabIndex        =   2
         Top             =   5160
         Width           =   1335
      End
      Begin VB.CommandButton Command2 
         Caption         =   "取 消 添 加"
         Height          =   495
         Left            =   3840
         TabIndex        =   1
         Top             =   5160
         Width           =   1335
      End
      Begin VB.Label Label8 
         BackStyle       =   0  'Transparent
         Caption         =   "备注"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H0080FFFF&
         Height          =   255
         Left            =   240
         TabIndex        =   17
         Top             =   2040
         Width           =   615
      End
      Begin VB.Label Label7 
         BackStyle       =   0  'Transparent
         Caption         =   "日期"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H0080FFFF&
         Height          =   255
         Left            =   3000
         TabIndex        =   16
         Top             =   1440
         Width           =   615
      End
      Begin VB.Label Label5 
         BackStyle       =   0  'Transparent
         Caption         =   "规格"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H0080FFFF&
         Height          =   255
         Left            =   240
         TabIndex        =   15
         Top             =   885
         Width           =   615
      End
      Begin VB.Label Label4 
         BackStyle       =   0  'Transparent
         Caption         =   "型  号"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H0080FFFF&
         Height          =   255
         Left            =   3000
         TabIndex        =   14
         Top             =   360
         Width           =   855
      End
      Begin VB.Label Label3 
         BackStyle       =   0  'Transparent
         Caption         =   "名称"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H0080FFFF&
         Height          =   255
         Left            =   240
         TabIndex        =   13
         Top             =   360
         Width           =   735
      End
      Begin VB.Label Label2 
         BackStyle       =   0  'Transparent
         Caption         =   "使用人"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H0080FFFF&
         Height          =   255
         Left            =   3000
         TabIndex        =   12
         Top             =   885
         Width           =   1695
      End
      Begin VB.Label Label9 
         BackStyle       =   0  'Transparent
         Caption         =   "数量"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H0080FFFF&
         Height          =   255
         Left            =   240
         TabIndex        =   11
         Top             =   1440
         Width           =   615
      End
   End
   Begin VB.Label Label1 
      BackStyle       =   0  'Transparent
      Caption         =   "编号"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H0080FFFF&
      Height          =   255
      Index           =   1
      Left            =   480
      TabIndex        =   18
      Top             =   240
      Width           =   615
   End
End
Attribute VB_Name = "FrmProadd"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub cmdCalendar_Click()
    Dim UserDate As Date
    UserDate = CVDate(txtRiqi)
    If FrmCalpro.GetDate(UserDate) Then
        txtRiqi = UserDate
    End If
End Sub

Private Sub Cmdcancle_Click()
Unload Me
End Sub

Private Sub cmdOK_Click()
  Dim mrc As ADODB.Recordset
  '定义字符串变量,表示查询语句
  Dim txtSQL As String
  '定义字符串变量,返回查询信息
  Dim MsgText As String
  '判断是否输入编号,编号是主键,不能为空
  If Not Testtxt(txtbh.Text) Then
        MsgBox "请输入财产编号!", vbOKOnly + vbExclamation, "警告"
        txtbh.SetFocus
      Exit Sub
  End If
  
  If Not Testtxt(txtName.Text) Then
        MsgBox "请输入财产名称!", vbOKOnly + vbExclamation, "警告"
      txtName.SetFocus
      Exit Sub
    End If
  
   '判断是否有重复的记录
    txtSQL = "select * from caichanguanli  where caichan_id = '" & Trim(txtbh.Text) & "'"
    Set mrc = ExecuteSQL(txtSQL, MsgText)
    If mrc.EOF = False Then
       MsgBox "该编号记录已存在!请重新输入", vbOKOnly + vbExclamation, "警告"
       mrc.Close
       txtbh.SetFocus
    Else
       mrc.Close
       '判断是否输入使用日期?
      If Testtxt(txtRiqi.Text) Then
       '判断输入的使用日期是否按照格式
             If Not IsDate(txtRiqi.Text) Then
               MsgBox "出生日期应输入日期格式(yyyy—mm—dd)!", vbOKOnly + vbExclamation, "警告"
               txtRiqi.SetFocus
                 Exit Sub
             Else
                 txtRiqi = Format(txtRiqi, "yyyy-mm-dd")
             End If
      Else
         txtRiqi.Text = "1900-01-01"
         txtRiqi = Format(txtRiqi, "yyyy-mm-dd")
      End If
       txtSQL = "select * from caichanguanli"
       '执行查询操作
       Set mrc = ExecuteSQL(txtSQL, MsgText)
       '添加记录
       mrc.AddNew
       mrc.Fields(0) = Trim(txtbh.Text)
       mrc.Fields(1) = Trim(txtName.Text)
       mrc.Fields(2) = Trim(txtGuige.Text)
       mrc.Fields(3) = Trim(txtType.Text)
       mrc.Fields(4) = Trim(txttotal.Text)
       mrc.Fields(5) = Trim(TxtOwner.Text)
       mrc.Fields(6) = Trim(txtRiqi.Text)
       mrc.Fields(7) = Trim(txtBeizhu.Text)
   
       mrc.Update
       MsgBox "添加信息成功", vbOKOnly + vbExclamation, "警告"
       '关闭数据集对象
       mrc.Close
       Call intform
       Me.Hide
    End If

End Sub
Public Sub intform()
txtbh.Text = ""
txtName.Text = ""
txtType.Text = ""
txtGuige.Text = ""
TxtOwner.Text = ""
txttotal.Text = ""
txtRiqi.Text = Date
txtBeizhu.Text = ""
End Sub
Private Sub Form_Load()
    Dim txtSQL As String
    Dim MsgText As String
    Dim mrcc As ADODB.Recordset
   '数据库中如果没有信息,则询问添加
    txtSQL = "select personnel_id ,name from personnel_infor"
    Set mrcc = ExecuteSQL(txtSQL, MsgText)
    If Not mrcc.EOF Then
       mrcc.MoveFirst
    Do While Not mrcc.EOF
         TxtOwner.AddItem Trim(mrcc.Fields(1))
        '移动到下一条记录
        mrcc.MoveNext
    Loop
    End If
    mrcc.Close
Call intform
End Sub

⌨️ 快捷键说明

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