?? frm_cgclgl.frm
字號(hào):
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 = ""
Text7.Text = ""
Text9.Text = ""
Text10.Text = ""
Text11.Text = ""
Combo1.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_cgb where 貨物編號(hào) like '%" + temp1 + "%'order by 貨物編號(hào)"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Adodc1.Recordset.MoveLast
Text1.Text = Adodc1.Recordset.Fields("貨物編號(hào)")
Text1.Text = Val(Adodc1.Recordset.Fields("貨物編號(hào)")) + 1
Else
Text1.Text = Format(Now, "yyyymmdd")
Text1.Text = Text1.Text + "0000"
End If
Adodc1.RecordSource = "select * from Table_cgb order by 貨物編號(hào)"
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_cgb"
'Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
c = MsgBox("確認(rèn)要?jiǎng)h除該信息嗎?", 17, "采購管理系統(tǒng)")
If c = vbOK Then
Adodc1.Recordset.Delete
Else
End If
Else
MsgBox "數(shù)據(jù)庫中的信息為空,沒有可刪除的信息!!", 64, "采購管理系統(tǒng)"
End If
End Sub
Private Sub Cmd_edit_Click()
Call main
c = MsgBox("確認(rèn)要修改該信息嗎?", 33, "采購管理系統(tǒng)")
If c = vbOK Then
Adodc1.Recordset.Delete
Set adoRs = adoCon.Execute("insert into Table_cgb values(" & Text1 & ",'" & Text2 & "','" & Text3 & "','" & Text4 & "','" & Text7 & "','" & Combo1 & "','" & Combo3 & "','" & Text9 & "','" & Text10 & "','" & Text5 & "','" & Text6 & "','" & DT1 & "','" & Text11 & "')")
MsgBox "數(shù)據(jù)修改成功!!", 64, "采購管理系統(tǒng)"
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()
Frame3.Visible = True
Frame1.Visible = False
End Sub
Private Sub Cmd_refurbish_Click()
Unload Me
frm_cgclgl.Refresh
frm_cgclgl.Show
End Sub
Private Sub Cmd_save_Click()
Call main
Adodc1.RecordSource = "select * from Table_cgb where 貨物編號(hào)='" + Text1.Text + "'"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount = 0 Then
c = MsgBox("確認(rèn)要保存該信息嗎?", 33, "采購管理系統(tǒng)")
If c = vbOK Then
Set adoRs = adoCon.Execute("insert into Table_cgb values(" & Text1 & ",'" & Text2 & "','" & Text3 & "','" & Text4 & "','" & Text7 & "','" & Combo1 & "','" & Combo3 & "','" & Text9 & "','" & Text10 & "','" & Text5 & "','" & Text6 & "','" & DT1 & "','" & Text11 & "')")
MsgBox "數(shù)據(jù)保存成功!!", 32, "采購管理系統(tǒng)"
Cmd_save.Enabled = False
Cmd_add.Enabled = True
Else
End If
Else
MsgBox "對(duì)不起,該信息已經(jīng)保存過,不能夠再進(jìn)行保存", 64, "采購管理系統(tǒng)"
End If
adoCon.Close
End Sub
Private Sub Combo1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Text5.SetFocus
Else
End If
End Sub
Private Sub Combo2_Change()
Text8.Text = Val(Text7.Text) * Val(Combo2.Text)
End Sub
Private Sub Combo2_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Text8.SetFocus
Else
End If
End Sub
Private Sub Combo2_LostFocus()
If Not IsNumeric(Combo2.Text) Then
MsgBox "輸入的數(shù)量信息必須為數(shù)值型數(shù)據(jù)"
Combo2.Text = ""
Combo2.SetFocus
Else
Text8.Text = Val(Text7.Text) * Val(Combo2.Text)
End If
End Sub
Private Sub Combo3_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Text9.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
Text12.SetFocus
End Sub
Private Sub Command1_Click()
If Combo5.Text = "" Or Combo4.Text = "" Or Text12.Text = "" Then
MsgBox "輸入或選擇的內(nèi)容不能為空值", 48, "采購管理系統(tǒng)"
ElseIf Combo5.Text = "數(shù)量" Or Combo5.Text = "金額" Or Combo5.Text = "貨物編號(hào)" Then
If Not IsNumeric(Text12.Text) Then
Text12.Text = ""
Text12.SetFocus
Else
a = Text12.Text
If i = 0 Then
Adodc1.RecordSource = "select * from Table_cgb where " + Combo5.Text + " " + Combo4.Text + " '" + a + "'"
Adodc1.Refresh
ElseIf i = 1 Then
Adodc1.RecordSource = "select * from Table_cgb where " + Combo5.Text + " like '%" + a + "%'"
Adodc1.Refresh
Else
End If
End If
Else
a = Text12.Text
If i = 0 Then
Adodc1.RecordSource = "select * from Table_cgb where " + Combo5.Text + " " + Combo4.Text + " '" + a + "'"
Adodc1.Refresh
ElseIf i = 1 Then
Adodc1.RecordSource = "select * from Table_cgb where " + Combo5.Text + " like '%" + a + "%'"
Adodc1.Refresh
Else
End If
End If
End Sub
Private Sub Command2_Click()
Frame1.Visible = True
Frame3.Visible = False
Adodc1.RecordSource = "select * from Table_cgb order by 貨物編號(hào)"
Adodc1.Refresh
End Sub
Private Sub DataGrid1_Click()
Adodc1.RecordSource = "select * from Table_cgb where 貨物編號(hào)='" + Text13.Text + "'"
' Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Text1.Text = Adodc1.Recordset.Fields("貨物編號(hào)")
Text2.Text = Adodc1.Recordset.Fields("貨物名稱")
Text3.Text = Adodc1.Recordset.Fields("供應(yīng)商編號(hào)")
Text4.Text = Adodc1.Recordset.Fields("供應(yīng)商名稱")
Text5.Text = Adodc1.Recordset.Fields("聯(lián)系人")
Text6.Text = Adodc1.Recordset.Fields("電話")
Text7.Text = Adodc1.Recordset.Fields("單價(jià)")
Text9.Text = Adodc1.Recordset.Fields("采購員編號(hào)")
Text10.Text = Adodc1.Recordset.Fields("采購員姓名")
Text11.Text = Adodc1.Recordset.Fields("備注")
DT1.Value = Adodc1.Recordset.Fields("采購日期")
Combo1.Text = Adodc1.Recordset.Fields("單位")
Combo3.Text = Adodc1.Recordset.Fields("結(jié)算幣")
Else
End If
End Sub
Private Sub DT1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Text11.SetFocus
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
DT1.Value = Date
frm_main.StatusBar1.Panels(1).Text = " 當(dāng)前操作: " & 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 "輸入的采購員編號(hào)必須為數(shù)字"
Else
Adodc1.RecordSource = "select * from Table_cgb where 貨物編號(hào)='" + 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("貨物編號(hào)")
Text2.Text = Adodc1.Recordset.Fields("貨物名稱")
Text3.Text = Adodc1.Recordset.Fields("供應(yīng)商編號(hào)")
Text4.Text = Adodc1.Recordset.Fields("供應(yīng)商名稱")
Text5.Text = Adodc1.Recordset.Fields("聯(lián)系人")
Text6.Text = Adodc1.Recordset.Fields("電話")
Text7.Text = Adodc1.Recordset.Fields("單價(jià)")
Text9.Text = Adodc1.Recordset.Fields("采購員編號(hào)")
Text10.Text = Adodc1.Recordset.Fields("采購員姓名")
Text11.Text = Adodc1.Recordset.Fields("備注")
DT1.Value = Adodc1.Recordset.Fields("采購日期")
Combo1.Text = Adodc1.Recordset.Fields("單位")
Combo3.Text = Adodc1.Recordset.Fields("結(jié)算幣")
Else
MsgBox "沒有該采購員的信息!!", 64, "采購管理系統(tǒng)"
End If
End If
Else
End If
End Sub
Private Sub Text10_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
DT1.SetFocus
Else
End If
End Sub
Private Sub Text11_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Call Cmd_save_Click
Else
End If
End Sub
Private Sub Text12_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
Text3.SetFocus
Else
End If
End Sub
Private Sub Text3_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
frm_gysxx_temp.Show
frm_gysxx_temp.DataGrid1.SetFocus
Else
End If
End Sub
Private Sub Text4_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Text7.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
Combo3.SetFocus
Else
End If
End Sub
Private Sub Text7_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Combo1.SetFocus
Else
End If
End Sub
Private Sub Text7_LostFocus()
If Not IsNumeric(Text7.Text) Then
MsgBox "輸入的單價(jià)信息必須為數(shù)值型數(shù)據(jù)"
Text7.Text = ""
Text7.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
frm_cgyxx_temp.Show
frm_cgyxx_temp.DataGrid1.SetFocus
Else
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
frm_main.StatusBar1.Panels(1).Text = " 吉林省明日科技有限公司"
End Sub
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -