?? frm_gysgl.frm
字號:
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 + -