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

📄 frm_scsgl.frm

📁 采购管理系统使用vb6.0 加sql2000数据库 编程
💻 FRM
📖 第 1 页 / 共 3 页
字号:
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim c, i, a
Option Explicit


Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long


Private Const HWND_TOPMOST& = -1

' 将窗口置于列表顶部,并位于任何最顶部窗口的前面

Private Const SWP_NOSIZE& = &H1

' 保持窗口大小

Private Const SWP_NOMOVE& = &H2

' 保持窗口位置

Private Sub cmd_add_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text8.Text = ""
Text9.Text = ""
Text7.Text = ""
Text12.Text = ""
Text13.Text = ""
Text1.Locked = True
cmd_save.Enabled = True
cmd_add.Enabled = False
cmd_del.Enabled = False
cmd_edit.Enabled = False
Dim temp1
'temp1 = Format(Now, "yyyymmdd")
Adodc1.RecordSource = "select * from Table_scsgl 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_scsgl 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_scsgl"
'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_scsgl values(" & Text1 & ",'" & Text2 & "','" & Text8 & "','" & Text5 & "','" & Text4 & "','" & Text9 & "','" & Text3 & "','" & Text12 & "','" & Text6 & "','" & Text7 & "','" & Text13 & "','" & Combo3 & "')")
 MsgBox "数据修改成功!!", 64, "采购管理系统"
 Adodc1.Refresh
 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_scsgl.Refresh
frm_scsgl.Show
End Sub


Private Sub Cmd_save_Click()
Call main
      If Text8.Text = "" Then Text8.Text = "无"
      If Text8.Text = "" Then Text8.Text = "无"
      If Text5.Text = "" Then Text5.Text = "无"
      If Text4.Text = "" Then Text4.Text = "无"
      If Text9.Text = "" Then Text9.Text = "无"
      If Text3.Text = "" Then Text3.Text = "无"
      If Text12.Text = "" Then Text12.Text = "无"
      If Text6.Text = "" Then Text6.Text = "无"
      If Text5.Text = "" Then Text5.Text = "无"
      If Text7.Text = "" Then Text7.Text = "无"
      If Text13.Text = "" Then Text13.Text = "无"
Adodc1.RecordSource = "select * from Table_scsgl where 生产商编号='" + Text1.Text + "'"
Adodc1.Refresh
If Text8.Text = "" Then Text8.Text = "wu"
If Adodc1.Recordset.RecordCount = 0 Then
c = MsgBox("确认要保存该信息吗?", 33, "采购管理系统")
   If c = vbOK Then
   Set adoRs = adoCon.Execute("insert into Table_scsgl values(" & Text1 & ",'" & Text2 & "','" & Text8 & "','" & Text5 & "','" & Text4 & "','" & Text9 & "','" & Text3 & "','" & Text12 & "','" & Text6 & "','" & Text7 & "','" & Text13 & "','" & Combo3 & "')")
   MsgBox "数据保存成功!!", 32, "采购管理系统"
   cmd_save.Enabled = False
   cmd_add.Enabled = True
   Else
   End If
Else
MsgBox "对不起,该信息已经保存过,不能够再进行保存", 64, "采购管理系统"
End If
Adodc1.RecordSource = "select * from Table_scsgl order by 生产商编号"
Adodc1.Refresh
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_scsgl where " + Combo1.Text + " " + Combo2.Text + " '" + a + "'"
       Adodc1.Refresh
       ElseIf i = 1 Then
       Adodc1.RecordSource = "select * from Table_scsgl 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_scsgl where " + Combo1.Text + " " + Combo2.Text + " '" + a + "'"
       Adodc1.Refresh
       ElseIf i = 1 Then
       Adodc1.RecordSource = "select * from Table_scsgl 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_scsgl order by 生产商编号"
Adodc1.Refresh
End Sub

Private Sub DataGrid1_Click()
      Adodc1.RecordSource = "select * from Table_scsgl where 生产商编号='" + Text11.Text + "'"
'      Adodc1.Refresh
      If Adodc1.Recordset.RecordCount > 0 Then
      Text1.Text = Adodc1.Recordset.Fields("生产商编号")
      Text2.Text = Adodc1.Recordset.Fields("生产商名称")
      Text8.Text = Adodc1.Recordset.Fields("简称")
      Text5.Text = Adodc1.Recordset.Fields("传真")
      Text4.Text = Adodc1.Recordset.Fields("E-mail")
      Text9.Text = Adodc1.Recordset.Fields("电话")
      Text3.Text = Adodc1.Recordset.Fields("联系人")
      Text12.Text = Adodc1.Recordset.Fields("国家")
      Text6.Text = Adodc1.Recordset.Fields("地址")
      Text5.Text = Adodc1.Recordset.Fields("传真")
      Text7.Text = Adodc1.Recordset.Fields("联系人电话")
      Text13.Text = Adodc1.Recordset.Fields("备注")
      
      Else
      End If
      cmd_del.Enabled = True
      cmd_edit.Enabled = True
      cmd_add.Enabled = True
End Sub

Private Sub Form_Load()
SetWindowPos Me.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE

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_scsgl 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 + -