?? frm_del_data.frm
字號(hào):
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form frm_del_Data
BorderStyle = 3 'Fixed Dialog
Caption = "數(shù)據(jù)清理"
ClientHeight = 2685
ClientLeft = 4005
ClientTop = 3330
ClientWidth = 6000
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2685
ScaleWidth = 6000
ShowInTaskbar = 0 'False
Begin MSComctlLib.ProgressBar ProgressBar1
Height = 270
Left = 90
TabIndex = 8
Top = 1965
Width = 5800
_ExtentX = 10239
_ExtentY = 476
_Version = 393216
Appearance = 1
End
Begin VB.CommandButton Command3
Caption = "全部選中"
Height = 375
Left = 2145
TabIndex = 3
Top = 2295
Width = 1245
End
Begin VB.Frame Frame1
Caption = "請(qǐng)選擇所要初始化的數(shù)據(jù)表"
Height = 1845
Left = 90
TabIndex = 2
Top = 75
Width = 5805
Begin VB.CheckBox Check8
Caption = "供應(yīng)商信息數(shù)據(jù)表"
Height = 300
Left = 2280
TabIndex = 12
Top = 1425
Width = 2145
End
Begin VB.CheckBox Check7
Caption = "庫(kù)存盤點(diǎn)數(shù)據(jù)表"
Height = 345
Left = 240
TabIndex = 11
Top = 1410
Width = 1725
End
Begin VB.CheckBox Check6
Caption = "貨品歸還數(shù)據(jù)表"
Height = 330
Left = 4095
TabIndex = 10
Top = 900
Width = 1635
End
Begin VB.CheckBox Check5
Caption = "貨品借出數(shù)據(jù)表"
Height = 330
Left = 2280
TabIndex = 9
Top = 915
Width = 1710
End
Begin VB.CheckBox Check4
Caption = "操作員資料數(shù)據(jù)表"
Height = 495
Left = 240
TabIndex = 7
Top = 840
Width = 1890
End
Begin VB.CheckBox Check3
Caption = "庫(kù)存資料數(shù)據(jù)表"
Height = 375
Left = 4095
TabIndex = 6
Top = 360
Width = 1600
End
Begin VB.CheckBox Check2
Caption = "出庫(kù)資料數(shù)據(jù)表"
Height = 375
Left = 2280
TabIndex = 5
Top = 360
Width = 1815
End
Begin VB.CheckBox Check1
Caption = "入庫(kù)資料數(shù)據(jù)表"
Height = 375
Left = 240
TabIndex = 4
Top = 360
Width = 1815
End
End
Begin VB.CommandButton Command2
Caption = "取消初始化"
Height = 375
Left = 4680
TabIndex = 1
Top = 2295
Width = 1230
End
Begin VB.CommandButton Command1
Caption = "確認(rèn)初始化"
Height = 375
Left = 3405
TabIndex = 0
Top = 2295
Width = 1255
End
End
Attribute VB_Name = "frm_del_Data"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'*** “系統(tǒng)初始化”按鈕的事件過(guò)程 ***
Private Sub Command1_Click()
rtn = SetWindowPos(Me.hwnd, -2, 0, 0, 0, 0, 3) '運(yùn)用API函數(shù)SetWindowPos,來(lái)實(shí)現(xiàn)取消窗體置前的功能
Command1.Enabled = False '在進(jìn)行初始化的過(guò)程中,使“系統(tǒng)初始化”按鈕不可用
Dim rs1 As ADODB.Recordset '定義一個(gè)記錄集對(duì)象rs1
Set rs1 = New ADODB.Recordset
Dim cnn1 As ADODB.Connection '定義一個(gè)連接對(duì)象cnn1
Set cnn1 = New ADODB.Connection
'與數(shù)據(jù)庫(kù)取得連接
cnn1.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db_kcgl.mdb;Persist Security Info=False"
Dim connter As Integer
Dim sql, workarea(200) As String '定義一個(gè)數(shù)組,用來(lái)實(shí)現(xiàn)在初始化數(shù)據(jù)時(shí)控制進(jìn)度條快慢的功能
ProgressBar1.Visible = True
'UBound函數(shù)和LBound函數(shù)分別用于指定數(shù)組的最大下標(biāo)和最小下標(biāo),關(guān)于該函數(shù)的具體用法請(qǐng)參閱明日公司《Visual Basic編程詞典》中的函數(shù)應(yīng)用部分 網(wǎng)址 www.cccxy.com
ProgressBar1.Max = UBound(workarea)
ProgressBar1.Value = ProgressBar1.Min
For connter = LBound(workarea) To UBound(workarea)
workarea(connter) = "initial value" & connter
ProgressBar1.Value = connter
If Check1.Value = 1 Then '利用SQL語(yǔ)句刪除入庫(kù)信息表中的數(shù)據(jù)
sql = "delete tb_in from tb_in"
Set rs1 = cnn1.Execute(sql)
End If
If Check2.Value = 1 Then '利用SQL語(yǔ)句刪除出庫(kù)信息表中的數(shù)據(jù)
sql = "delete tb_out from tb_out"
Set rs1 = cnn1.Execute(sql)
End If
If Check3.Value = 1 Then '利用SQL語(yǔ)句刪除庫(kù)存信息表中的數(shù)據(jù)
sql = "delete tb_kcxx from tb_kcxx"
Set rs1 = cnn1.Execute(sql)
End If
If Check4.Value = 1 Then '利用SQL語(yǔ)句刪除操作員資料信息表中的數(shù)據(jù)
sql = "delete tb_enter from tb_enter"
Set rs1 = cnn1.Execute(sql)
End If
If Check5.Value = 1 Then '利用SQL語(yǔ)句刪除貨品借出信息表中的數(shù)據(jù)
sql = "delete tb_hpout from tb_hpout"
Set rs1 = cnn1.Execute(sql)
End If
If Check6.Value = 1 Then '利用SQL語(yǔ)句刪除貨品歸還信息表中的數(shù)據(jù)
sql = "delete tb_hpin from tb_hpin"
Set rs1 = cnn1.Execute(sql)
End If
If Check7.Value = 1 Then '利用SQL語(yǔ)句刪除庫(kù)存盤點(diǎn)信息表中的數(shù)據(jù)
sql = "delete tb_kcpd from tb_kcpd"
Set rs1 = cnn1.Execute(sql)
End If
If Check8.Value = 1 Then '利用SQL語(yǔ)句刪除供應(yīng)商信息表中的數(shù)據(jù)
sql = "delete tb_gys from tb_gys"
Set rs1 = cnn1.Execute(sql)
End If
Next connter
ProgressBar1.Value = ProgressBar1.Min
cnn1.Close '關(guān)閉數(shù)據(jù)連接
Check1.Value = 0
Check2.Value = 0
Check3.Value = 0
Check4.Value = 0
Check5.Value = 0
Check6.Value = 0
Check7.Value = 0
Check8.Value = 0
MsgBox "初始化成功完成!!", 48, "初始化信息提示"
Command1.Enabled = True '使“系統(tǒng)初始化”按鈕變?yōu)榭捎?End Sub
Private Sub Command2_Click()
Unload Me
End Sub
'*** “全部選中”按鈕的事件過(guò)程 ***
Private Sub Command3_Click()
'若想使操作員具有所有的權(quán)限,應(yīng)該使所有復(fù)選框中的值都為“真”
Check1.Value = 1
Check2.Value = 1
Check3.Value = 1
Check4.Value = 1
Check5.Value = 1
Check6.Value = 1
Check7.Value = 1
Check8.Value = 1
End Sub
Private Sub Form_Load()
rtn = SetWindowPos(Me.hwnd, -1, 0, 0, 0, 0, 3) '運(yùn)用API函數(shù)SetWindowPos,來(lái)實(shí)現(xiàn)使窗體置前的功能
Me.Left = (Screen.Width - Me.Width) / 2
Me.Top = (Screen.Height - Me.Height) / 2
End Sub
Private Sub Form_Unload(Cancel As Integer)
frm_main.Enabled = True
End Sub
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -