?? frm_cgygl.frm
字號(hào):
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 = "關(guān)閉"
Height = 350
Left = 6840
TabIndex = 6
Top = 200
Width = 855
End
Begin VB.CommandButton Cmd_query
Caption = "查詢(xún)"
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 = "查詢(xún)條件"
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 采購(gòu)員編號(hào) "
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Adodc1.Recordset.MoveLast
Text1.Text = Adodc1.Recordset.Fields("采購(gòu)員編號(hào)")
Text1.Text = Val(Adodc1.Recordset.Fields("采購(gòu)員編號(hào)")) + 1
Else
Text1.Text = 1000
End If
Adodc1.RecordSource = "select * from Table_cgyxx order by 采購(gòu)員編號(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_cgyxx"
'Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
c = MsgBox("確認(rèn)要?jiǎng)h除該信息嗎?", 17, "采購(gòu)管理系統(tǒng)")
If c = vbOK Then
Adodc1.Recordset.Delete
Else
End If
Else
MsgBox "數(shù)據(jù)庫(kù)中的信息為空,沒(méi)有可刪除的信息!!", 64, "采購(gòu)管理系統(tǒng)"
End If
End Sub
Private Sub Cmd_edit_Click()
Call main
c = MsgBox("確認(rèn)要修改該信息嗎?", 33, "采購(gòu)管理系統(tǒng)")
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 "數(shù)據(jù)修改成功!!", 64, "采購(gòu)管理系統(tǒng)"
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 采購(gòu)員編號(hào)='" + Text1.Text + "'"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount = 0 Then
c = MsgBox("確認(rèn)要保存該信息嗎?", 33, "采購(gòu)管理系統(tǒng)")
If c = vbOK Then
Set adoRs = adoCon.Execute("insert into Table_cgyxx values(" & Text1 & ",'" & Text2 & "','" & Combo1 & "','" & Text3 & "','" & Combo2 & "','" & Text4 & "','" & Combo3 & "','" & Text5 & "','" & Text6 & "')")
MsgBox "數(shù)據(jù)保存成功!!", 32, "采購(gòu)管理系統(tǒng)"
Cmd_save.Enabled = False
Cmd_add.Enabled = True
Else
End If
Else
MsgBox "對(duì)不起,該信息已經(jīng)保存過(guò),不能夠再進(jìn)行保存", 64, "采購(gòu)管理系統(tǒng)"
End If
Adodc1.RecordSource = "select * from Table_cgyxx order by 采購(gòu)員編號(hào)"
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, "采購(gòu)管理系統(tǒng)"
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, "采購(gòu)管理系統(tǒng)"
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 "輸入或選擇的內(nèi)容不能為空值", 48, "采購(gòu)管理系統(tǒng)"
ElseIf Combo5.Text = "采購(gòu)員編號(hào)" 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 采購(gòu)員編號(hào)"
Adodc1.Refresh
End Sub
Private Sub DataGrid1_Click()
Adodc1.RecordSource = "select * from Table_cgyxx where 采購(gòu)員編號(hào)='" + Text7.Text + "' "
' Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Text1.Text = Adodc1.Recordset.Fields("采購(gòu)員編號(hào)")
Text2.Text = Adodc1.Recordset.Fields("姓名")
Text3.Text = Adodc1.Recordset.Fields("年齡")
Text4.Text = Adodc1.Recordset.Fields("籍貫")
Text5.Text = Adodc1.Recordset.Fields("電話(huà)")
Text6.Text = Adodc1.Recordset.Fields("現(xiàn)住址")
Combo1.Text = Adodc1.Recordset.Fields("性別")
Combo2.Text = Adodc1.Recordset.Fields("民族")
Combo3.Text = Adodc1.Recordset.Fields("學(xué)歷")
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 = " 當(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 "輸入的采購(gòu)員編號(hào)必須為數(shù)字"
Else
Adodc1.RecordSource = "select * from Table_cgyxx where 采購(gòu)員編號(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.Locked = True
Text1.Text = Adodc1.Recordset.Fields("采購(gòu)員編號(hào)")
Text2.Text = Adodc1.Recordset.Fields("姓名")
Text3.Text = Adodc1.Recordset.Fields("年齡")
Text4.Text = Adodc1.Recordset.Fields("籍貫")
Text5.Text = Adodc1.Recordset.Fields("電話(huà)")
Text6.Text = Adodc1.Recordset.Fields("現(xiàn)住址")
Combo1.Text = Adodc1.Recordset.Fields("性別")
Combo2.Text = Adodc1.Recordset.Fields("民族")
Combo3.Text = Adodc1.Recordset.Fields("學(xué)歷")
Else
MsgBox "沒(méi)有該采購(gòu)員的信息!!", 64, "采購(gòu)管理系統(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
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 "輸入的信息必須為數(shù)值型!!"
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
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -