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

📄 frm_gysgl.frm

📁 采用VB和SQL2000 开发的 采购管理系统 对初学有很大帮助
💻 FRM
📖 第 1 页 / 共 2 页
字号:
      Left            =   2400
      TabIndex        =   36
      Text            =   "Text11"
      Top             =   4200
      Width           =   1575
   End
   Begin VB.Frame Frame3 
      Height          =   615
      Left            =   0
      TabIndex        =   29
      Top             =   0
      Width           =   7815
      Begin VB.CommandButton Command2 
         Caption         =   "取消"
         Height          =   350
         Left            =   6840
         TabIndex        =   35
         Top             =   200
         Width           =   855
      End
      Begin VB.CommandButton Command1 
         Caption         =   "确定"
         Height          =   350
         Left            =   5880
         TabIndex        =   34
         Top             =   200
         Width           =   855
      End
      Begin VB.TextBox Text10 
         Height          =   300
         Left            =   3960
         TabIndex        =   33
         Top             =   240
         Width           =   1575
      End
      Begin VB.ComboBox Combo2 
         Height          =   300
         ItemData        =   "frm_gysgl.frx":0015
         Left            =   2880
         List            =   "frm_gysgl.frx":002B
         Style           =   2  'Dropdown List
         TabIndex        =   32
         Top             =   240
         Width           =   975
      End
      Begin VB.ComboBox Combo1 
         Height          =   300
         ItemData        =   "frm_gysgl.frx":004C
         Left            =   1080
         List            =   "frm_gysgl.frx":005F
         Style           =   2  'Dropdown List
         TabIndex        =   31
         Top             =   240
         Width           =   1695
      End
      Begin VB.Label Label10 
         Caption         =   "查询条件"
         ForeColor       =   &H00808000&
         Height          =   195
         Left            =   120
         TabIndex        =   30
         Top             =   320
         Width           =   975
      End
   End
   Begin VB.Frame Frame1 
      Height          =   615
      Left            =   0
      TabIndex        =   0
      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
End
Attribute VB_Name = "frm_gysgl"
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 = ""
Text8.Text = ""
Text9.Text = ""
Text7.Text = ""
Text1.Locked = True
Cmd_save.Enabled = True
Cmd_add.Enabled = False
Dim temp1
'temp1 = Format(Now, "yyyymmdd")
Adodc1.RecordSource = "select * from Table_gysxx 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_gysxx 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_gysxx"
'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_gysxx values(" & Text1 & ",'" & Text2 & "','" & Text8 & "','" & Text5 & "','" & Text9 & "','" & Text4 & "','" & Text3 & "','" & Text7 & "','" & Text6 & "')")
 MsgBox "数据修改成功!!", 64, "采购管理系统"
 Cmd_edit.Enabled = False
 Else
 End If
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_gysgl.Refresh
frm_gysgl.Show
End Sub

Private Sub Cmd_save_Click()
Call main
Adodc1.RecordSource = "select * from Table_gysxx 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_gysxx values(" & Text1 & ",'" & Text2 & "','" & Text8 & "','" & Text5 & "','" & Text9 & "','" & Text4 & "','" & Text3 & "','" & Text7 & "','" & Text6 & "')")
   MsgBox "数据保存成功!!", 32, "采购管理系统"
   Cmd_save.Enabled = False
   Cmd_add.Enabled = True
   Else
   End If
Else
MsgBox "对不起,该信息已经保存过,不能够再进行保存", 64, "采购管理系统"
End If
adoCon.Close
End Sub

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

Private Sub Command1_Click()
If Combo1.Text = "" Or Combo2.Text = "" Or Text10.Text = "" Then
MsgBox "输入或选择的内容不能为空值", 48, "采购管理系统"
ElseIf Combo1.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_gysxx where " + Combo1.Text + " " + Combo2.Text + " '" + a + "'"
       Adodc1.Refresh
       ElseIf i = 1 Then
       Adodc1.RecordSource = "select * from Table_gysxx where " + Combo1.Text + " like '%" + a + "%'"
       Adodc1.Refresh
       Else
       End If
    End If
Else
    a = Text10.Text
       If i = 0 Then
       Adodc1.RecordSource = "select * from Table_gysxx where " + Combo1.Text + " " + Combo2.Text + " '" + a + "'"
       Adodc1.Refresh
       ElseIf i = 1 Then
       Adodc1.RecordSource = "select * from Table_gysxx where " + Combo1.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_gysxx order by 供应商编号"
Adodc1.Refresh
End Sub

Private Sub DataGrid1_Click()
      Adodc1.RecordSource = "select * from Table_gysxx where 供应商编号='" + Text11.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("E-mail")
      Text5.Text = Adodc1.Recordset.Fields("传真")
      Text6.Text = Adodc1.Recordset.Fields("地址")
      Text8.Text = Adodc1.Recordset.Fields("简称")
      Text9.Text = Adodc1.Recordset.Fields("电话")
      Text7.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_gysxx where 供应商编号='" + Text1.Text + "'"
      Adodc1.Refresh
      If Adodc1.Recordset.RecordCount > 0 Then
      Cmd_del.Enabled = True
      Cmd_save.Enabled = True
      Cmd_edit.Enabled = True
      Text1.Text = Adodc1.Recordset.Fields("供应商编号")
      Text2.Text = Adodc1.Recordset.Fields("供应商名称")
      Text3.Text = Adodc1.Recordset.Fields("联系人")
      Text4.Text = Adodc1.Recordset.Fields("E-mail")
      Text5.Text = Adodc1.Recordset.Fields("传真")
      Text6.Text = Adodc1.Recordset.Fields("地址")
      Text8.Text = Adodc1.Recordset.Fields("简称")
      Text9.Text = Adodc1.Recordset.Fields("电话")
      Text7.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
Text8.SetFocus
Else
End If
End Sub
Private Sub Text3_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Text7.SetFocus
Else
End If
End Sub
Private Sub Text4_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Text9.SetFocus
Else
End If
End Sub

Private Sub Text5_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Text4.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 Text7_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Text6.SetFocus
Else
End If
End Sub

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

Private Sub Text9_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Text3.SetFocus
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 + -