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

📄 form9.frm

📁 设备管理系统,对设备的入库,出库,借出与归还的管理
💻 FRM
📖 第 1 页 / 共 2 页
字号:
         Index           =   3
         Left            =   1680
         MultiLine       =   -1  'True
         ScrollBars      =   2  'Vertical
         TabIndex        =   9
         Top             =   2820
         Width           =   1935
      End
      Begin VB.TextBox Text1 
         BackColor       =   &H00C0FFC0&
         Height          =   390
         Index           =   2
         Left            =   1665
         TabIndex        =   8
         Top             =   2040
         Width           =   1830
      End
      Begin VB.TextBox Text1 
         BackColor       =   &H00C0FFC0&
         Height          =   390
         Index           =   1
         Left            =   1665
         TabIndex        =   7
         Top             =   1200
         Width           =   1830
      End
      Begin VB.TextBox Text1 
         BackColor       =   &H00C0FFC0&
         Height          =   390
         Index           =   0
         Left            =   1665
         Locked          =   -1  'True
         TabIndex        =   6
         Top             =   360
         Width           =   1830
      End
      Begin VB.Label Label4 
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Caption         =   "备注"
         Height          =   495
         Left            =   240
         TabIndex        =   5
         Top             =   3000
         Width           =   1215
      End
      Begin VB.Label Label3 
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Caption         =   "国标编码"
         Height          =   495
         Left            =   240
         TabIndex        =   4
         Top             =   2115
         Width           =   1215
      End
      Begin VB.Label Label2 
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Caption         =   "名称"
         Height          =   495
         Left            =   240
         TabIndex        =   3
         Top             =   1245
         Width           =   1215
      End
      Begin VB.Label Label1 
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Caption         =   "编号"
         Height          =   495
         Left            =   240
         TabIndex        =   2
         Top             =   360
         Width           =   1215
      End
   End
   Begin VB.Label Label5 
      BackColor       =   &H00C0FFC0&
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   360
      Left            =   240
      TabIndex        =   16
      Top             =   6360
      Width           =   3990
   End
End
Attribute VB_Name = "Form9"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim i As Integer         '用于FOR循环中的变量
Dim StrNum As Long       '定义一个用于保存编号信息的变量
'*** “添加”供应商信息按钮的事件过程 ***
Private Sub Cmd_Add_Click()
On Error Resume Next
   For i = 0 To 3
      Text1(i).Text = ""
   Next i
        Adodc1.RecordSource = "select * from jiben_sb order by 编号"
        Adodc1.Refresh
           If Adodc1.Recordset.RecordCount > 0 Then
               Adodc1.Recordset.MoveLast
               StrNum = Val(Adodc1.Recordset.Fields("编号")) + 1
                Text1(0).Text = StrNum
           Else
               Text1(0).Text = "1"                                '如果数据库中没有记录,则给供应商编号赋一个初值
               'StrNum = 1
           End If
   Text1(1).SetFocus
   cmd_save.Enabled = True
   cmd_del.Enabled = False
   cmd_edit.Enabled = False
End Sub
'*** “删除”供应商信息按钮的事件过程 ***
Private Sub Cmd_del_Click()
    If Adodc1.Recordset.EOF = False Then
          c = MsgBox("您确认要删除该记录吗?", 17, "删除提示信息")
                 If c = vbOK Then
                    If Text1(0).Text = "" Then
                        MsgBox "请选择您要删除的记录!", 17, "提示"
                    Else
                      Adodc1.Recordset.Delete     '删除所选中的记录信息
                      Adodc1.Refresh
                   
                         For i = 0 To 3          '在删除完信息之后,清空文本框中的内容
                           Text1(i).Text = ""
                         Next i
                    cmd_del.Enabled = False
                    Call TRefresh                 '调用数据刷新过程
                     End If
                 End If
     Else
               MsgBox "当前数据库中已经没有可删除的记录", 64, "提示信息"
     End If
End Sub
'*** “修改”供应商信息按钮的事件过程 ***
Private Sub Cmd_edit_Click()
   If Text1(0).Text = "" Or Text1(1).Text = "" Then
      MsgBox "请选择需要改动的记录信息!", 48, "信息提示"
   Else
        c = MsgBox("确认要修改该记录吗?", 33, "修改信息提示")
           If c = vbOK Then                                   '如果确认修改的话进行修改操作
               If Text1(1).Text = "" Then
                  MsgBox "供应商名称不能为空值!", 48, "修改信息提示"
               Else
                          Call main     '调用公共模块中的连接数据库函数
                            '利用SQL语句修改供应商信息
                            Set adoRs = adoCon.Execute("UPDATE jiben_sb SET 名称='" + Text1(1).Text + "',国标编码='" + Text1(2).Text + "',备注='" + Text1(3).Text + "'  where 编号='" + Text1(0) + "'")
'                            ETemp = 0                   '修改标识
'                            Call joinRZ                 '调用添加日志过程,添加修改信息日志
                            MsgBox "信息修改成功", 64, "修改信息提示"
                            cmd_edit.Enabled = False
                          adoCon.Close                  '关闭数据连接
                          Call TRefresh                 '调用数据刷新过程
                End If
            Else
            End If
   End If
End Sub
Private Sub Cmd_exit_Click()
  Unload Me
End Sub
'*** “保存”供应商信息按钮的事件过程 ***
Private Sub Cmd_save_Click()

        c = MsgBox("您确认要保存该信息吗?", 33, "保存信息提示")
          If c = vbOK Then
               If Text1(1).Text = "" Or Text1(2).Text = "" Then                  '确保供应商名称及联系人信息输入不为空值
                  MsgBox "供应商名称及联系人等信息不能为空值!", 48, "保存信息提示"
               Else
                            Call main                                            '调用公共模块中的连接数据库函数
                               'Val是字符转换函数,用于将字符型数据转换为数值型数据,Mid函数是用于取字符串中具体值的函数
                               NumId = Val(Mid(Text1(0).Text, 2, Len(Text1(0).Text)))
                               '保存供应商信息
                               Set adoRs = adoCon.Execute("insert into jiben_sb(编号,名称,国标编码,备注) values('" & Text1(0).Text & "','" & Text1(1).Text & "','" & Text1(2).Text & "','" & Text1(3).Text & "')")
                                  MsgBox "信息保存成功", 64, "保存信息提示"
                                  cmd_save.Enabled = False
                             adoCon.Close
                             Call TRefresh                               '调用数据刷新过程
                End If
     
          End If
 
End Sub

Private Sub Command1_Click()

form12.Text1(2) = Text1(0).Text
Form15.Text1(2) = Text1(0).Text
Form13.Text1(2) = Text1(0).Text
Form14.Text1(2) = Text1(0).Text
Command2_Click
End Sub

Private Sub Command2_Click()
Unload Me
End Sub

Private Sub Command3_Click()
 tb = "jiben_sb"
 Form17.Show 1
End Sub

Private Sub DataGrid1_RowColChange(LastRow As Variant, ByVal LastCol As Integer)
  Call JionBack                                        '调用数据信息反绑定过程
  cmd_del.Enabled = True
  cmd_edit.Enabled = True
  cmd_save.Enabled = False
End Sub '''''''''''''''''''''''''''''''''''''''''''''''''''' 这里只能选择这个事件,如果是click的话,还得双击


Private Sub Form_Load()
   Me.Left = (Screen.Width - Me.Width) / 2
   Me.Top = (Screen.Height - Me.Height) / 2
   Frame2.Visible = True
   Frame3.Visible = False
End Sub
'*** 自定义数据信息反绑定的过程 ***
Private Sub JionBack()
On Error Resume Next     '执行错误处理
Dim SLen As Integer
  If Adodc1.Recordset.RecordCount > 0 Then
      StrNum = Val(Adodc1.Recordset.Fields("编号"))

     '将数据信息反绑定到文本框当中
     Text1(0).Text = Trim(Adodc1.Recordset(0)) 'trim太重要了,这个地方由于长度设死了,而'''''''哈哈;;;;;;;;;;'
     Text1(1).Text = Trim(Adodc1.Recordset(1))
     Text1(2).Text = Trim(Adodc1.Recordset(2))
     Text1(3).Text = Trim(Adodc1.Recordset(3))
     
  End If
End Sub
'*** 自定义数据刷新的过程 ***
Private Sub TRefresh()
    Adodc1.RecordSource = "select * from jiben_sb order by 编号"
    Adodc1.Refresh
End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
sql = ""
End Sub

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


Private Sub Timer1_Timer()
      If Adodc1.Recordset.RecordCount > 0 Then
           Label5.Caption = "目前数据库中共有 " & Adodc1.Recordset.RecordCount & " 条设备类型"
      Else
           Label5.Caption = "目前数据库中尚没有设备类型记录"
      End If
End Sub
Private Sub Form_Activate()
'sql1 = "select * from " & sql
  If sql <> "" Then
     Adodc1.RecordSource = sql1
     Adodc1.Refresh
     If Adodc1.Recordset.RecordCount > 0 Then
        Call JionBack
        Adodc1.Recordset.Update
     Else
        MsgBox "没有找到符合条件的记录!", , "提示窗口"
     End If
  End If
End Sub

⌨️ 快捷键说明

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