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

📄 form8.frm

📁 设备管理系统,对设备的入库,出库,借出与归还的管理
💻 FRM
📖 第 1 页 / 共 2 页
字号:
         Height          =   495
         Left            =   360
         Style           =   1  'Graphical
         TabIndex        =   14
         Top             =   4200
         Width           =   1335
      End
      Begin VB.CommandButton cmd_save 
         BackColor       =   &H00C0C0FF&
         Caption         =   "保存(&S)"
         Height          =   495
         Left            =   360
         Style           =   1  'Graphical
         TabIndex        =   13
         Top             =   3150
         Width           =   1335
      End
      Begin VB.CommandButton cmd_edit 
         BackColor       =   &H00C0C0FF&
         Caption         =   "修改(&X)"
         Height          =   495
         Left            =   360
         Style           =   1  'Graphical
         TabIndex        =   12
         Top             =   2220
         Width           =   1335
      End
      Begin VB.CommandButton cmd_del 
         BackColor       =   &H00C0C0FF&
         Caption         =   "删除(&D)"
         Height          =   495
         Left            =   360
         Style           =   1  'Graphical
         TabIndex        =   11
         Top             =   1290
         Width           =   1335
      End
      Begin VB.CommandButton cmd_add 
         BackColor       =   &H00C0C0FF&
         Caption         =   "添加(&A)"
         Default         =   -1  'True
         Height          =   495
         Left            =   360
         Style           =   1  'Graphical
         TabIndex        =   10
         Top             =   360
         Width           =   1335
      End
   End
   Begin VB.Frame Frame1 
      BackColor       =   &H00FFC0FF&
      Height          =   4935
      Left            =   255
      TabIndex        =   0
      Top             =   150
      Width           =   4215
      Begin VB.TextBox Text1 
         BackColor       =   &H00C0C0FF&
         Height          =   375
         Index           =   0
         Left            =   1590
         Locked          =   -1  'True
         TabIndex        =   9
         Top             =   345
         Width           =   2205
      End
      Begin VB.Label Label7 
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Caption         =   "备注"
         Height          =   375
         Left            =   120
         TabIndex        =   8
         Top             =   4320
         Width           =   1455
      End
      Begin VB.Label Label6 
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Caption         =   "地址"
         Height          =   375
         Left            =   120
         TabIndex        =   7
         Top             =   3560
         Width           =   1455
      End
      Begin VB.Label Label5 
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Caption         =   "传真"
         Height          =   375
         Left            =   120
         TabIndex        =   6
         Top             =   2920
         Width           =   1455
      End
      Begin VB.Label Label4 
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Caption         =   "联系电话"
         Height          =   375
         Left            =   120
         TabIndex        =   5
         Top             =   2280
         Width           =   1455
      End
      Begin VB.Label Label3 
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Caption         =   "业务联系人"
         Height          =   375
         Left            =   120
         TabIndex        =   4
         Top             =   1640
         Width           =   1455
      End
      Begin VB.Label Label2 
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Caption         =   "名称"
         Height          =   375
         Left            =   120
         TabIndex        =   3
         Top             =   1000
         Width           =   1455
      End
      Begin VB.Label Label1 
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Caption         =   "编号"
         Height          =   375
         Left            =   120
         TabIndex        =   2
         Top             =   360
         Width           =   1455
      End
   End
   Begin VB.Label Label8 
      BackColor       =   &H00C0FFC0&
      Caption         =   "Label8"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   270
      Left            =   225
      TabIndex        =   22
      Top             =   6825
      Width           =   4215
   End
End
Attribute VB_Name = "Form8"
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 6
      Text1(i).Text = ""
   Next i
        Adodc1.RecordSource = "select * from jiben_gy 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"                                '如果数据库中没有记录,则给供应商编号赋一个初值
           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 6          '在删除完信息之后,清空文本框中的内容
                           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_gy SET 名称='" + Text1(1).Text + "',业务联系人='" + Text1(2).Text + "',联系电话='" + Text1(3).Text + "',传真='" + Text1(4).Text + "',地址='" + Text1(5).Text + "', 备注='" + Text1(6).Text + "' where 编号='" + Text1(0) + "'")
                            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                                            '调用公共模块中的连接数据库函数
                               NumId = Val(Mid(Text1(0).Text, 2, Len(Text1(0).Text)))
                               '保存供应商信息
                               Set adoRs = adoCon.Execute("insert into jiben_gy(编号,名称,业务联系人,联系电话,传真,地址,备注) values('" & Text1(0).Text & "','" & Text1(1).Text & "','" & Text1(2).Text & "','" & Text1(3).Text & "','" & Text1(4).Text & "','" & Text1(5).Text & "','" & Text1(6).Text & "')")
                                  MsgBox "信息保存成功", 64, "保存信息提示"
                                  cmd_save.Enabled = False
                             adoCon.Close
                             Call TRefresh                               '调用数据刷新过程
                End If
         
          End If

End Sub

Private Sub Command1_Click()
form12.Text1(7).Text = Text1(0).Text
Form13.Text1(4).Text = Text1(0).Text
Unload Me
End Sub

Private Sub Command2_Click()
Unload Me
End Sub



Private Sub Command3_Click()
 tb = "jiben_gy"
 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

Private Sub Form_Load()
   Me.Left = (Screen.Width - Me.Width) / 2
   Me.Top = (Screen.Height - Me.Height) / 2
End Sub
'*** 自定义数据信息反绑定的过程 ***
Private Sub JionBack()
On Error Resume Next     '执行错误处理
    Dim i As Integer
  If Adodc1.Recordset.RecordCount > 0 Then
  For i = 0 To Text1.UBound
    Text1(i) = DataGrid1.Columns(i).Text
  Next i
  End If
End Sub
'*** 自定义数据刷新的过程 ***
Private Sub TRefresh()
    Adodc1.RecordSource = "select * from jiben_gy 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
           Label8.Caption = "目前数据库中共有 " & Adodc1.Recordset.RecordCount & " 条供应商数据"
      Else
           Label8.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 + -