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

📄 ckadd.frm

📁 用VB做的一个数据库管理系统
💻 FRM
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form CKCPGL 
   AutoRedraw      =   -1  'True
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "产品管理"
   ClientHeight    =   5175
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   8460
   Icon            =   "ckadd.frx":0000
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   5175
   ScaleWidth      =   8460
   ShowInTaskbar   =   0   'False
   Begin VB.Frame Frame1 
      Height          =   690
      Left            =   120
      TabIndex        =   6
      Top             =   75
      Width           =   8145
      Begin VB.CommandButton Command4 
         Caption         =   "向上(&R)"
         Enabled         =   0   'False
         Height          =   435
         Left            =   3885
         TabIndex        =   4
         Top             =   180
         Width           =   1260
      End
      Begin VB.CommandButton Command3 
         Caption         =   "删除(&D)"
         Enabled         =   0   'False
         Height          =   435
         Left            =   2625
         TabIndex        =   3
         Top             =   180
         Width           =   1260
      End
      Begin VB.CommandButton Command2 
         Caption         =   "添加(&A)"
         Enabled         =   0   'False
         Height          =   435
         Left            =   1365
         TabIndex        =   2
         Top             =   180
         Width           =   1260
      End
      Begin VB.CommandButton Command1 
         Caption         =   "关闭(&C)"
         Height          =   435
         Left            =   105
         TabIndex        =   1
         Top             =   180
         Width           =   1260
      End
      Begin VB.PictureBox Picture1 
         AutoRedraw      =   -1  'True
         BackColor       =   &H00808000&
         Height          =   405
         Left            =   5190
         ScaleHeight     =   345
         ScaleWidth      =   2775
         TabIndex        =   7
         Top             =   195
         Width           =   2835
         Begin VB.Label PromptL 
            Alignment       =   2  'Center
            BackStyle       =   0  'Transparent
            Caption         =   "请选择产品的类型后,双击。"
            ForeColor       =   &H0000FF00&
            Height          =   180
            Left            =   60
            TabIndex        =   5
            Top             =   90
            Width           =   2670
         End
      End
   End
   Begin MSFlexGridLib.MSFlexGrid Grid2 
      Height          =   4170
      Left            =   150
      TabIndex        =   0
      Top             =   870
      Width           =   8145
      _ExtentX        =   14367
      _ExtentY        =   7355
      _Version        =   393216
      Rows            =   20
      Cols            =   6
      BackColorFixed  =   8438015
      BackColorSel    =   8421376
      BackColorBkg    =   12632256
      AllowBigSelection=   0   'False
      FocusRect       =   0
      ScrollBars      =   2
      SelectionMode   =   1
      AllowUserResizing=   1
   End
   Begin MSFlexGridLib.MSFlexGrid Grid1 
      Height          =   4170
      Left            =   0
      TabIndex        =   8
      Top             =   0
      Width           =   8145
      _ExtentX        =   14367
      _ExtentY        =   7355
      _Version        =   393216
      Rows            =   20
      Cols            =   6
      BackColorFixed  =   8438015
      BackColorSel    =   8421376
      BackColorBkg    =   12632256
      AllowBigSelection=   0   'False
      FocusRect       =   0
      ScrollBars      =   2
      SelectionMode   =   1
      AllowUserResizing=   1
   End
End
Attribute VB_Name = "CKCPGL"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Unload Me
End Sub

Private Sub Command2_Click()
Me.MousePointer = 11
   ADDproduct.Show 1
Me.MousePointer = 0
End Sub

Private Sub Command3_Click()
 If Grid1.Text = "" Then Exit Sub
   Dim QR As Integer
    QR = MsgBox("真的要删除产品[" & Grid1.Text & "]吗?(Y/N)", vbYesNo + 16, "删除确认")
    If QR = 7 Then
       Exit Sub
    End If
'删除记录
  Dim DB As Database, RecStr As String
  Set DB = OpenDatabase(App.Path & "\Sys\Store.mdb", 0, 0, Constr)
         RecStr = "产品类型='" & CpTypeName & "' and 产品名称='" & Grid1.Text & "'"
         RecStr = "Delete * From CPK Where " & RecStr
         DB.Execute RecStr
         DB.Close
'配置网格Grid1
Grid1.Visible = False
Grid1.Clear
Grid1.Cols = 4
Grid1.FormatString = "^ 序号 |^ 产品名称 |^ 单位 |^ 单价 "
Grid1.ColWidth(0) = 830
Grid1.ColWidth(1) = 3300
Grid1.ColWidth(2) = 2230
Grid1.ColWidth(3) = 1420
    Set DB = OpenDatabase(App.Path & "\Sys\Store.mdb", 0, 0, Constr)
    Set Ef = DB.OpenRecordset("CPK", dbOpenTable)
        Grid1.Rows = Ef.RecordCount + 15
    Set Ef = DB.OpenRecordset("Select * From CPK Where 产品类型='" & CpTypeName & "'", dbOpenDynaset)
        HH = 1
        Do While Not Ef.EOF()
           Grid1.Row = HH
           Grid1.Col = 1
           Grid1.CellAlignment = 1
        If Not IsNull(Ef.Fields(1).Value) Then
           Grid1.Text = Ef.Fields(1).Value
        End If
           Grid1.Row = HH
           Grid1.Col = 2
           Grid1.CellAlignment = 1
        If Not IsNull(Ef.Fields(2).Value) Then
           Grid1.Text = Ef.Fields(2).Value
        End If
           Grid1.Row = HH
           Grid1.Col = 3
           Grid1.CellAlignment = 1
        If Not IsNull(Ef.Fields(3).Value) Then
           Grid1.Text = Ef.Fields(3).Value
        End If
          Ef.MoveNext
          HH = HH + 1
        Loop
        DB.Close
For HH = 1 To Grid1.Rows - 1
    Grid1.Row = HH
    Grid1.Col = 0
    Grid1.Text = HH
    If Len(Grid1.Text) = 1 Then
     Grid1.Text = "0" + Grid1.Text
     End If
 Next
 Grid1.Col = 1
 Grid1.Row = 1
 Grid1.ColSel = 3
 Grid1.Visible = True
End Sub

Private Sub Command4_Click()
PromptL.Caption = "请选择产品的类型后,双击。"
Grid1.Visible = False
Grid2.Visible = True
Command2.Enabled = False
Command3.Enabled = False
Command4.Enabled = False
End Sub

Private Sub Form_Load()
CKCPGL.Left = (MDIForm1.Width - CKCPGL.Width) / 2
CKCPGL.Top = (MDIForm1.Height - CKCPGL.Height) / 2 - 1000
Grid1.Left = Grid2.Left
Grid1.Top = Grid2.Top
Grid1.Visible = False
 '配置网格
Grid2.Visible = False
Grid2.Cols = 2
Grid2.FormatString = "^ 序号 |^ 产 品 类 型 名 "
Grid2.ColWidth(0) = 830
Grid2.ColWidth(1) = 7230
    Set DB = OpenDatabase(App.Path & "\Sys\Store.mdb", 0, 0, Constr)
    Set Ef = DB.OpenRecordset("CPLX", dbOpenTable)
        Grid2.Rows = Ef.RecordCount + 15
    Set Ef = DB.OpenRecordset("Select * From CPLX", dbOpenDynaset)
        HH = 1
        Do While Not Ef.EOF()
           Grid2.Row = HH
           Grid2.Col = 1
           Grid2.CellAlignment = 1
        If Not IsNull(Ef.Fields(0).Value) Then
           Grid2.Text = Ef.Fields(0).Value
        End If
          Ef.MoveNext
          HH = HH + 1
        Loop
        DB.Close
For HH = 1 To Grid2.Rows - 1
    Grid2.Row = HH
    Grid2.Col = 0
    Grid2.Text = HH
    If Len(Grid2.Text) = 1 Then
     Grid2.Text = "0" + Grid2.Text
     End If
 Next
 Grid2.Col = 1
 Grid2.Row = 1
 Grid2.ColSel = 1
 Grid2.Visible = True
End Sub

Private Sub Grid1_DblClick()
If Grid1.MouseCol = 0 Or Grid1.MouseRow = 0 Then Exit Sub
If Grid1.Text <> "" Then Exit Sub
Me.MousePointer = 11
   ADDproduct.Show 1
Me.MousePointer = 0
End Sub

Private Sub Grid2_DblClick()
If Grid2.MouseCol = 0 Or Grid2.MouseRow = 0 Or Grid2.Text = "" Then Exit Sub
   CpTypeName = Grid2.Text
   PromptL.Caption = "添、删[" & CpTypeName & "]中的产品种类!"
   Command2.Enabled = True
   Command3.Enabled = True
   Command4.Enabled = True
   Grid1.Visible = True
   Grid2.Visible = False
 '配置网格
Grid1.Visible = False
Grid1.Clear
Grid1.Cols = 4
Grid1.FormatString = "^ 序号 |^ 产品名称 |^ 单位 |^ 单价 "
Grid1.ColWidth(0) = 830
Grid1.ColWidth(1) = 3300
Grid1.ColWidth(2) = 2230
Grid1.ColWidth(3) = 1420
    Set DB = OpenDatabase(App.Path & "\Sys\Store.mdb", 0, 0, Constr)
    Set Ef = DB.OpenRecordset("CPK", dbOpenTable)
        Grid1.Rows = Ef.RecordCount + 15
    Set Ef = DB.OpenRecordset("Select * From CPK Where 产品类型='" & CpTypeName & "'", dbOpenDynaset)
        HH = 1
        Do While Not Ef.EOF()
           Grid1.Row = HH
           Grid1.Col = 1
           Grid1.CellAlignment = 1
        If Not IsNull(Ef.Fields(1).Value) Then
           Grid1.Text = Ef.Fields(1).Value
        End If
           Grid1.Row = HH
           Grid1.Col = 2
           Grid1.CellAlignment = 1
        If Not IsNull(Ef.Fields(2).Value) Then
           Grid1.Text = Ef.Fields(2).Value
        End If
           Grid1.Row = HH
           Grid1.Col = 3
           Grid1.CellAlignment = 1
        If Not IsNull(Ef.Fields(3).Value) Then
           Grid1.Text = Ef.Fields(3).Value
        End If
          Ef.MoveNext
          HH = HH + 1
        Loop
        DB.Close
For HH = 1 To Grid1.Rows - 1
    Grid1.Row = HH
    Grid1.Col = 0
    Grid1.Text = HH
    If Len(Grid1.Text) = 1 Then
     Grid1.Text = "0" + Grid1.Text
     End If
 Next
 Grid1.Col = 1
 Grid1.Row = 1
 Grid1.ColSel = 3
 Grid1.Visible = True
End Sub

⌨️ 快捷键说明

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