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

📄 files_input.frm

📁 小型客户管理系统
💻 FRM
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form Files_input 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "客户文档存放信息"
   ClientHeight    =   3135
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   8550
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3135
   ScaleWidth      =   8550
   StartUpPosition =   2  '屏幕中心
   Begin MSComDlg.CommonDialog CommonDialog1 
      Left            =   4080
      Top             =   2520
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
   End
   Begin VB.CommandButton cmdCancel 
      Caption         =   "取消"
      Height          =   495
      Left            =   7080
      TabIndex        =   18
      Top             =   2520
      Width           =   1215
   End
   Begin VB.CommandButton cmdOK 
      Caption         =   "确认"
      Height          =   495
      Left            =   5880
      TabIndex        =   17
      Top             =   2520
      Width           =   1215
   End
   Begin VB.Frame Frame1 
      Caption         =   "客户文档存放信息"
      Height          =   2295
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   8295
      Begin VB.CommandButton cmdChoose 
         Caption         =   "选择"
         Height          =   375
         Left            =   7320
         TabIndex        =   19
         Top             =   1680
         Width           =   615
      End
      Begin VB.TextBox Wjm 
         Height          =   375
         Left            =   1200
         Locked          =   -1  'True
         TabIndex        =   6
         Top             =   720
         Width           =   1500
      End
      Begin VB.TextBox Wjdx 
         Height          =   375
         Left            =   3720
         Locked          =   -1  'True
         TabIndex        =   5
         Top             =   720
         Width           =   1500
      End
      Begin VB.TextBox Wjlx 
         Height          =   390
         Left            =   6480
         Locked          =   -1  'True
         TabIndex        =   4
         Top             =   720
         Width           =   1500
      End
      Begin VB.TextBox Xgsj 
         Height          =   375
         Left            =   1200
         Locked          =   -1  'True
         TabIndex        =   3
         Text            =   "1900-01-01"
         Top             =   1200
         Width           =   1500
      End
      Begin VB.TextBox Bcz 
         Height          =   375
         Left            =   3720
         Locked          =   -1  'True
         TabIndex        =   2
         Top             =   1200
         Width           =   1500
      End
      Begin VB.TextBox Cflj 
         Height          =   375
         Left            =   1200
         Locked          =   -1  'True
         TabIndex        =   1
         Top             =   1680
         Width           =   6060
      End
      Begin VB.Label khmc 
         Caption         =   "客户名称"
         Height          =   255
         Left            =   3480
         TabIndex        =   16
         Top             =   360
         Width           =   4500
      End
      Begin VB.Label khbh 
         Caption         =   "客户编号"
         Height          =   255
         Left            =   1200
         TabIndex        =   15
         Top             =   360
         Width           =   975
      End
      Begin VB.Label Label7 
         Caption         =   "文件类型"
         Height          =   255
         Left            =   5400
         TabIndex        =   14
         Top             =   750
         Width           =   795
      End
      Begin VB.Label Label6 
         Caption         =   "文件大小"
         Height          =   255
         Left            =   2760
         TabIndex        =   13
         Top             =   750
         Width           =   795
      End
      Begin VB.Label Label5 
         Caption         =   "保存者"
         Height          =   255
         Left            =   2760
         TabIndex        =   12
         Top             =   1230
         Width           =   795
      End
      Begin VB.Label Label4 
         Caption         =   "修改时间"
         Height          =   255
         Left            =   240
         TabIndex        =   11
         Top             =   1230
         Width           =   795
      End
      Begin VB.Label Label3 
         Caption         =   "文件名"
         Height          =   255
         Left            =   240
         TabIndex        =   10
         Top             =   750
         Width           =   795
      End
      Begin VB.Label Label2 
         Caption         =   "客户名称"
         Height          =   255
         Left            =   2520
         TabIndex        =   9
         Top             =   360
         Width           =   795
      End
      Begin VB.Label Label1 
         Caption         =   "客户编号"
         Height          =   255
         Left            =   240
         TabIndex        =   8
         Top             =   360
         Width           =   800
      End
      Begin VB.Label Label9 
         Caption         =   "存放路径"
         Height          =   255
         Left            =   240
         TabIndex        =   7
         Top             =   1710
         Width           =   795
      End
   End
End
Attribute VB_Name = "Files_input"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private FilePath As String
Private Fs As New FileSystemObject
Private FileTypeRS As New ADODB.Recordset

Private Sub cmdCancel_Click()
Unload Me
End Sub

Private Sub cmdChoose_Click()
Dim FileKzm As String

Call OpenFile
Wjm.Text = CommonDialog1.FileTitle
Cflj.Text = CommonDialog1.FileName
Bcz.Text = UserName

Wjdx.Text = FileLen(FilePath)
Xgsj.Text = FileDateTime(FilePath)

FileKzm = Right(CommonDialog1.FileTitle, 3)
Set FileTypeRS = Nothing
FileTypeRS.Open "select * from file_type where 文件扩展名='" & FileKzm & "'", MainDB, adOpenStatic, adLockOptimistic
If FileTypeRS.RecordCount = 1 Then
   Wjlx.Text = FileTypeRS!文件类型
Else
   Wjlx.Text = FileKzm & "文件"
End If
End Sub

'打开文件
Private Sub OpenFile()
CommonDialog1.ShowOpen
On Error GoTo err
   FilePath = CommonDialog1.FileName
   Exit Sub
err:
   MsgBox "没有选定的文件,请重试", vbInformation, "信息提示"
End Sub

Private Sub cmdOK_Click()
Dim Sqlstring As String
Sqlstring = ""

Select Case OperateState
       Case "add"
            Sqlstring = "insert into Files_DATA (客户编号,文件名,文件大小,文件类型,存放路径,修改时间,保存者) values(" _
                      & ClientCode & ",'" & Wjm.Text & "','" & Wjdx.Text & "','" & Wjlx.Text & "','" & Cflj.Text & "','" & Xgsj.Text & "','" & Bcz.Text & "')"
            If Wjm.Text <> "" Then
               MainDB.Execute (Sqlstring)
               Unload Me
            Else
               MsgBox "请选择文件", vbExclamation, "警告"
            End If
       Case "modify"
            Sqlstring = "update Files_DATA set " _
                                                  & "文件名='" & Wjm.Text & "'," _
                                                  & "文件大小='" & Wjdx.Text & "'," _
                                                  & "文件类型='" & Wjlx.Text & "'," _
                                                  & "存放路径='" & Cflj.Text & "'," _
                                                  & "修改时间='" & Xgsj.Text & "'," _
                                                  & "保存者='" & Bcz.Text & "'" _
                         & " where 客户编号=" & ClientCode & " and 数据编号=" & DataCode
            If ClientCode > 0 Then
               MainDB.Execute (Sqlstring)
               Unload Me
            End If
End Select

Set MainRS = Nothing
MainRS.Open "select * from " & OperateDB & " where 客户编号=" & ClientCode, MainDB, adOpenStatic, adLockOptimistic
Set Data_list.Adodc1.Recordset = MainRS
End Sub

Private Sub Form_Load()
khbh.Caption = ClientCode
Khmc.Caption = ClientName

If OperateState = "modify" Then
   Call Read_Data
End If

End Sub

Private Sub Form_Unload(Cancel As Integer)
MDIForm1.Enabled = True
End Sub

'读取修改数据
Private Sub Read_Data()
Dim I As Integer

Wjm.Text = MainRS!文件名
Wjdx.Text = MainRS!文件大小
Wjlx.Text = MainRS!文件类型
Cflj.Text = MainRS!存放路径
Xgsj.Text = MainRS!修改时间
Bcz.Text = MainRS!保存者
End Sub

⌨️ 快捷键说明

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