【正文】
Dim user As New ClassUser uid = Call fillUserGrid End If End If End With End SubPrivate Sub Form_Load() Dim rs As Dim strSQL As String strSQL = SELECT * FROM tblTypeInfo ORDER BY TypeNO Set rs = (strSQL) With rs Do Until .EOF .Fields(TypeNO).value amp。,39。 ORDER BY DESC Else strSQL = SELECT a.*, FROM (tblDevice AS A INNER JOIN tblDepartment AS B ON =) INNER JOIN tblTypeInfo C ON = ORDER BY DESC End If = fillDeviceGrid grdQuery, strSQL End SubPrivate Sub cmdReject_Click() Dim iid As String Dim strDate As String With grdDevice If .Row = 0 Then MsgBox 請選擇要報(bào)廢的設(shè)備! Else If MsgBox(你是否真的要報(bào)廢當(dāng)前選擇的設(shè)備嗎?報(bào)廢后將不能恢復(fù)!, vbOKCancel) = vbOK Then .Col = 1 iid = .Text strDate = getDate() If Len(strDate) 0 Then Dim device As New classDevice If (iid, strDate) = True Then .Tag = fillDeviceGrid grdDevice End If Set device = Nothing End If End If End If End WithEnd SubPrivate Sub cmdReport1_Click() Dim report As New drDevice Dim rs As Set rs = (SELECT * FROM tbldevice) With report Set .DataSource = rs .DataMember = .Show vbModal End With Set report = NothingEnd SubPrivate Sub cmdReport2_Click() Dim report As New drDepartment Dim rs As Set rs = (SELECT department,count(*) as countofDevice, sum(productprice) as sumofDevice FROM tbldevice a inner join tbldepartment b on = group by ) With report Set .DataSource = rs .DataMember = .Show vbModal End With Set report = NothingEnd SubPrivate Sub cmdReport3_Click() Dim report As New drReject Dim rs As Set rs = (SELECT devicename, department,rejectdate FROM tbldevice a inner join tbldepartment b on = where rejectdate is not null) With report Set .DataSource = rs .DataMember = .Show vbModal End With Set report = NothingEnd SubPrivate Sub cmdReport4_Click() Dim report As New drCost Dim rs As Set rs = (SELECT devicename, department,productprice, productcost FROM tbldevice a inner join tbldepartment b on =) With report Set .DataSource = rs .DataMember = .Show vbModal End With Set report = NothingEnd SubPrivate Sub cmdReset_Click() If MsgBox(你是否真的要重置數(shù)據(jù)庫嗎?這個(gè)操作將會刪除所有記錄!, vbOKCancel + vbDefaultButton2) = vbOK Then delete from tbldevice delete from tbluser delete from tbllend insert into tbluser (login,pwd,level) values (39。 End If End If If Len(strSQL) 0 Then strSQL = SELECT a.*, FROM (tblDevice AS A INNER JOIN tblDepartment AS B ON =) INNER JOIN tblTypeInfo C ON = WHERE amp。 DeviceModel amp。 Else strSQL = DeviceModel LIKE 39。 DeviceModel amp。 AND DeviceModel LIKE 39。 %39。% amp。 %39。% amp。 End If End If End If If Len(DeviceName) 0 Then If Len(strSQL) 0 Then strSQL = strSQL amp。 Else strSQL = RejectDate= amp。 AND RejectDate= amp。 End If End If End If If Len(RejectDateto) 0 Then If Not IsDate(RejectDateto) Then MsgBox 注銷日期輸入不正確,請重新輸入。 Else strSQL = RejectDate= amp。 AND RejectDate= amp。 End If End If End If If Len(RejectDatefrom) 0 Then If Not IsDate(RejectDatefrom) Then MsgBox 注銷日期輸入不正確,請重新輸入。 Else strSQL = ProductPrice= amp。 AND PurchaseDate= amp。 End If End If End If If Len(PurchaseDateto) 0 Then If Not IsDate(PurchaseDateto) Then MsgBox 購買日期輸入不正確,請重新輸入。 Else strSQL = ProductPrice= amp。 AND PurchaseDate= amp。 Priceto End If End If End If If Len(PurchaseDatefrom) 0 Then If Not IsDate(PurchaseDatefrom) Then MsgBox 購買日期輸入不正確,請重新輸入。 AND ProductPrice= amp。 Pricefrom End If End If End If If Len(Priceto) 0 Then If Not IsNumeric(Priceto) Then MsgBox 購買價(jià)格輸入不正確,請重新輸入。 AND ProductPrice= amp。) Pricefrom = Trim() Priceto = Trim() PurchaseDatefrom = Trim(txtDate(0).Text) PurchaseDateto = Trim(txtDate(1).Text) RejectDatefrom = Trim(txtDate(2).Text) RejectDateto = Trim(txtDate(3).Text) If Len(Pricefrom) 0 Then If Not IsNumeric(Pricefrom) Then MsgBox 購買價(jià)格輸入不正確,請重新輸入。, 39。39。 End If End If DeviceName = Replace(Trim(), 39。 TypeNo amp。 Else strSQL = =39。 TypeNo amp。 End If If 0 Then TypeNo = getTypeNO() If Len(strSQL) 0 Then strSQL = AND =39。 DeptNo amp。 newPath Exit Sub err_handle: MsgBox MsgBox 備份不成功!End SubPrivate Sub cmdDelete_Click() Dim iid As String With grdDevice If .Row = 0 Then MsgBox 請選擇要?jiǎng)h除的設(shè)備! Else If MsgBox(你是否真的要?jiǎng)h除當(dāng)前選擇的設(shè)備嗎?刪除后將不能恢復(fù)!, vbOKCancel) = vbOK Then .Col