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

📄 frm_cgygl.frm

📁 采用VB和SQL2000 开发的 采购管理系统 对初学有很大帮助
💻 FRM
📖 第 1 页 / 共 2 页
字号:
      Top             =   0
      Width           =   7815
      Begin VB.CommandButton Cmd_refurbish 
         Caption         =   "刷新"
         Height          =   350
         Left            =   4920
         TabIndex        =   9
         Top             =   200
         Width           =   855
      End
      Begin VB.CommandButton Cmd_save 
         Caption         =   "保存"
         Enabled         =   0   'False
         Height          =   350
         Left            =   3000
         TabIndex        =   8
         Top             =   200
         Width           =   855
      End
      Begin VB.CommandButton Cmd_exit 
         Caption         =   "关闭"
         Height          =   350
         Left            =   6840
         TabIndex        =   6
         Top             =   200
         Width           =   855
      End
      Begin VB.CommandButton Cmd_query 
         Caption         =   "查询"
         Height          =   350
         Left            =   5880
         TabIndex        =   5
         Top             =   200
         Width           =   855
      End
      Begin VB.CommandButton Cmd_cancel 
         Caption         =   "取消"
         Height          =   350
         Left            =   3960
         TabIndex        =   4
         Top             =   200
         Width           =   855
      End
      Begin VB.CommandButton Cmd_edit 
         Caption         =   "修改"
         Enabled         =   0   'False
         Height          =   350
         Left            =   2040
         TabIndex        =   3
         Top             =   200
         Width           =   855
      End
      Begin VB.CommandButton Cmd_del 
         Caption         =   "删除"
         Enabled         =   0   'False
         Height          =   350
         Left            =   1080
         TabIndex        =   2
         Top             =   200
         Width           =   855
      End
      Begin VB.CommandButton Cmd_add 
         Caption         =   "增加"
         Height          =   350
         Left            =   120
         TabIndex        =   1
         Top             =   200
         Width           =   855
      End
   End
   Begin VB.Frame Frame3 
      Height          =   615
      Left            =   0
      TabIndex        =   29
      Top             =   0
      Width           =   7815
      Begin VB.ComboBox Combo5 
         Height          =   300
         ItemData        =   "frm_cgygl.frx":00CE
         Left            =   1080
         List            =   "frm_cgygl.frx":00E1
         Style           =   2  'Dropdown List
         TabIndex        =   34
         Top             =   240
         Width           =   1695
      End
      Begin VB.ComboBox Combo4 
         Height          =   300
         ItemData        =   "frm_cgygl.frx":0109
         Left            =   2880
         List            =   "frm_cgygl.frx":011F
         Style           =   2  'Dropdown List
         TabIndex        =   33
         Top             =   240
         Width           =   975
      End
      Begin VB.TextBox Text10 
         Height          =   300
         Left            =   3960
         TabIndex        =   32
         Top             =   240
         Width           =   1575
      End
      Begin VB.CommandButton Command1 
         Caption         =   "确定"
         Height          =   350
         Left            =   5880
         TabIndex        =   31
         Top             =   200
         Width           =   855
      End
      Begin VB.CommandButton Command2 
         Caption         =   "取消"
         Height          =   350
         Left            =   6840
         TabIndex        =   30
         Top             =   200
         Width           =   855
      End
      Begin VB.Label Label10 
         Caption         =   "查询条件"
         ForeColor       =   &H00808000&
         Height          =   195
         Left            =   120
         TabIndex        =   35
         Top             =   320
         Width           =   975
      End
   End
End
Attribute VB_Name = "frm_cgygl"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim c, i, a
Private Sub Cmd_add_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Combo2.Text = ""
Combo3.Text = ""
Text1.Locked = True
Cmd_save.Enabled = True
Cmd_add.Enabled = False
Dim temp1
'temp1 = Format(Now, "yyyymmdd")
Adodc1.RecordSource = "select * from Table_cgyxx order by 采购员编号 "
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Adodc1.Recordset.MoveLast
Text1.Text = Adodc1.Recordset.Fields("采购员编号")
Text1.Text = Val(Adodc1.Recordset.Fields("采购员编号")) + 1
Else
Text1.Text = 1000
End If
Adodc1.RecordSource = "select * from Table_cgyxx order by 采购员编号"
Adodc1.Refresh
Text2.SetFocus
End Sub

Private Sub Cmd_cancel_Click()
Text1.Locked = False
Cmd_del.Enabled = False
Cmd_save.Enabled = False
Cmd_add.Enabled = True
Cmd_edit.Enabled = False
End Sub

Private Sub Cmd_del_Click()
Adodc1.RecordSource = "select * from Table_cgyxx"
'Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
c = MsgBox("确认要删除该信息吗?", 17, "采购管理系统")
If c = vbOK Then
Adodc1.Recordset.Delete
Else
End If
Else
MsgBox "数据库中的信息为空,没有可删除的信息!!", 64, "采购管理系统"
End If
End Sub

Private Sub Cmd_edit_Click()
Call main
  c = MsgBox("确认要修改该信息吗?", 33, "采购管理系统")
  If c = vbOK Then
  Adodc1.Recordset.Delete
  Set adoRs = adoCon.Execute("insert into Table_cgyxx values(" & Text1 & ",'" & Text2 & "','" & Combo1 & "','" & Text3 & "','" & Combo2 & "','" & Text4 & "','" & Combo3 & "','" & Text5 & "','" & Text6 & "')")
  MsgBox "数据修改成功!!", 64, "采购管理系统"
  Cmd_edit.Enabled = False
  Else
  End If
  Cmd_refurbish_Click
adoCon.Close
End Sub

Private Sub Cmd_exit_Click()
Unload Me
End Sub

Private Sub Cmd_query_Click()
Frame1.Visible = False
Frame3.Visible = True
End Sub

Private Sub Cmd_refurbish_Click()
Unload Me
frm_cgygl.Refresh
frm_cgygl.Show
End Sub

Private Sub Cmd_save_Click()
Call main
Adodc1.RecordSource = "select * from Table_cgyxx where 采购员编号='" + Text1.Text + "'"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount = 0 Then
c = MsgBox("确认要保存该信息吗?", 33, "采购管理系统")
If c = vbOK Then
  Set adoRs = adoCon.Execute("insert into Table_cgyxx values(" & Text1 & ",'" & Text2 & "','" & Combo1 & "','" & Text3 & "','" & Combo2 & "','" & Text4 & "','" & Combo3 & "','" & Text5 & "','" & Text6 & "')")
  MsgBox "数据保存成功!!", 32, "采购管理系统"
  Cmd_save.Enabled = False
  Cmd_add.Enabled = True
Else
End If
Else
MsgBox "对不起,该信息已经保存过,不能够再进行保存", 64, "采购管理系统"
End If
Adodc1.RecordSource = "select * from Table_cgyxx order by 采购员编号"
Adodc1.Refresh
adoCon.Close
End Sub

Private Sub Combo1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
  If Combo1.Text = "男" Or Combo1.Text = "女" Then
  Text3.SetFocus
  Exit Sub
  Else
  MsgBox "输入的性别只能是“男”或者“女”!!", 64, "采购管理系统"
  Combo1.Text = ""
  Combo1.SetFocus
  End If
Else
End If
End Sub

Private Sub Combo1_LostFocus()
If Combo1.Text = "男" Or Combo1.Text = "女" Then
Exit Sub
Else
MsgBox "输入的性别只能是“男”或者“女”!!", 64, "采购管理系统"
Combo1.Text = ""
Combo1.SetFocus
End If
End Sub

Private Sub Combo2_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Text4.SetFocus
Else
End If
End Sub

Private Sub Combo3_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Combo2.SetFocus
Else
End If
End Sub

Private Sub Combo4_Click()
If Combo4.Text <> " Like" Then
i = 0
ElseIf Combo4.Text = " Like" Then
i = 1
Else
End If
Text10.SetFocus
End Sub

Private Sub Command1_Click()
If Combo5.Text = "" Or Combo4.Text = "" Or Text10.Text = "" Then
MsgBox "输入或选择的内容不能为空值", 48, "采购管理系统"
ElseIf Combo5.Text = "采购员编号" Or Combo5.Text = "年龄" Then
    If Not IsNumeric(Text10.Text) Then
    Text10.Text = ""
    Text10.SetFocus
    Else
    a = Text10.Text
       If i = 0 Then
       Adodc1.RecordSource = "select * from Table_cgyxx where " + Combo5.Text + " " + Combo4.Text + " '" + a + "'"
       Adodc1.Refresh
       ElseIf i = 1 Then
       Adodc1.RecordSource = "select * from Table_cgyxx where " + Combo5.Text + " like '%" + a + "%'"
       Adodc1.Refresh
       Else
       End If
    End If
Else
    a = Text10.Text
       If i = 0 Then
       Adodc1.RecordSource = "select * from Table_cgyxx where " + Combo5.Text + " " + Combo4.Text + " '" + a + "'"
       Adodc1.Refresh
       ElseIf i = 1 Then
       Adodc1.RecordSource = "select * from Table_cgyxx where " + Combo5.Text + " like '%" + a + "%'"
       Adodc1.Refresh
       Else
       End If
End If
End Sub
Private Sub Command2_Click()
Frame3.Visible = False
Frame1.Visible = True
Adodc1.RecordSource = "select * from Table_cgyxx order by 采购员编号"
Adodc1.Refresh
End Sub

Private Sub DataGrid1_Click()
      Adodc1.RecordSource = "select * from Table_cgyxx where 采购员编号='" + Text7.Text + "' "
'      Adodc1.Refresh
      If Adodc1.Recordset.RecordCount > 0 Then
      Text1.Text = Adodc1.Recordset.Fields("采购员编号")
      Text2.Text = Adodc1.Recordset.Fields("姓名")
      Text3.Text = Adodc1.Recordset.Fields("年龄")
      Text4.Text = Adodc1.Recordset.Fields("籍贯")
      Text5.Text = Adodc1.Recordset.Fields("电话")
      Text6.Text = Adodc1.Recordset.Fields("现住址")
      Combo1.Text = Adodc1.Recordset.Fields("性别")
      Combo2.Text = Adodc1.Recordset.Fields("民族")
      Combo3.Text = Adodc1.Recordset.Fields("学历")
      Else
      End If
End Sub

Private Sub Form_Load()
Me.Left = (Screen.Width - Me.Width) / 2
Me.Top = (Screen.Height - Me.Height) / 2
Frame1.Visible = True
Frame3.Visible = False
frm_main.StatusBar1.Panels(1).Text = " 当前操作: " & Me.Caption
End Sub

Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
   If Not IsNumeric(Text1.Text) Then
   MsgBox "输入的采购员编号必须为数字"
   Else
      Adodc1.RecordSource = "select * from Table_cgyxx where 采购员编号='" + Text1.Text + "'"
      Adodc1.Refresh
      If Adodc1.Recordset.RecordCount > 0 Then
      Cmd_del.Enabled = True
      Cmd_save.Enabled = True
      Cmd_edit.Enabled = True
      Text1.Locked = True
      Text1.Text = Adodc1.Recordset.Fields("采购员编号")
      Text2.Text = Adodc1.Recordset.Fields("姓名")
      Text3.Text = Adodc1.Recordset.Fields("年龄")
      Text4.Text = Adodc1.Recordset.Fields("籍贯")
      Text5.Text = Adodc1.Recordset.Fields("电话")
      Text6.Text = Adodc1.Recordset.Fields("现住址")
      Combo1.Text = Adodc1.Recordset.Fields("性别")
      Combo2.Text = Adodc1.Recordset.Fields("民族")
      Combo3.Text = Adodc1.Recordset.Fields("学历")
      Else
      MsgBox "没有该采购员的信息!!", 64, "采购管理系统"
      End If
   End If
Else
End If
End Sub

Private Sub Text10_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Call Command1_Click
Else
End If
End Sub

Private Sub Text2_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Combo1.SetFocus
Else
End If
End Sub
Private Sub Text3_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Combo3.SetFocus
Else
End If
End Sub

Private Sub Text3_LostFocus()
If Not IsNumeric(Text3.Text) Then
MsgBox "输入的信息必须为数值型!!"
Text3.Text = ""
Text3.SetFocus
Else
End If
End Sub

Private Sub Text4_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Text5.SetFocus
Else
End If
End Sub

Private Sub Text5_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Text6.SetFocus
Else
End If
End Sub

Private Sub Text6_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Call Cmd_save_Click
Else
End If
End Sub

Private Sub Form_Unload(Cancel As Integer)
  frm_main.StatusBar1.Panels(1).Text = " 吉林省明日科技有限公司"
End Sub

⌨️ 快捷键说明

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