【正文】
strSQL = SELECT a.*, FROM (tblDevice AS A INNER JOIN tblDepartment AS B ON =) INNER JOIN tblTypeInfo C ON = ORDER BY DESC End If rowindex = 1 With grid If .Tag = Then Set rs = (strSQL) .Rows = 1 .Cols = 13 .Row = 0 .Col = 0 .Text = 序號 .Col = 1 .Text = ID .ColWidth(1) = 0 .Col = 2 .Text = 設(shè)備編號 .Col = 3 .Text = 設(shè)備名稱 .Col = 4 .Text = 設(shè)備型號 .Col = 5 .Text = 設(shè)備分類 .Col = 6 .Text = 所屬部門 .Col = 7 .Text = 購買價格 .Col = 8 .Text = 折舊成本 .Col = 9 .Text = 購買日期 .Col = 10 .Text = 狀態(tài) .Col = 11 .Text = 報廢日期 .Col = 12 .Text = 注銷日期 Do Until strRowData = rowindex amp。 rs(IID).value amp。 rs(DeviceNO).value amp。 rs(DeviceName).value amp。 rs(DeviceModel).value amp。 rs(TypeName).value amp。 rs(Department).value amp。 rs(ProductPrice).value amp。 rs(Productcost).value amp。 FormatDateTime(rs(PurchaseDate).value, vbLongDate) amp。 在庫 amp。 借出 amp。 rs(RejectDate).value amp。 rs(DisCardDate).value amp。 vbTab strRowData = strRowData amp。 vbTab strRowData = strRowData amp。 vbTab Select Case rs(userlevel).value Case 1 strRowData = strRowData amp。 vbTab Case 0 strRowData = strRowData amp。 vbTab Case 1 strRowData = strRowData amp。 vbTab End Select .AddItem strRowData rowindex = rowindex + 1 Loop Set rs = Nothing .Tag = 1 End IfEnd WithEnd SubPrivate Function getDeptNo() As String Dim str As String Dim pos As Integer With cboQDept str = .List(.ListIndex) End With pos = InStr(str, ) getDeptNo = Left(str, pos 1)End FunctionPrivate Function getTypeNO() As String Dim str As String Dim pos As Integer With cboQTypeNO str = .List(.ListIndex) End With pos = InStr(str, ) getTypeNO = Left(str, pos 1)End Function:用戶登陸代碼設(shè)計:Private Sub cmdCancel_Click() With theUser If .isDirty Then If MsgBox(你已經(jīng)更改數(shù)據(jù),是否做保存數(shù)據(jù)后再退出?, vbYesNo) = vbYes Then If saveData() = False Then Exit Sub End If End If End If End With End SubPrivate Sub cmdDelete_Click() () isUpdate = True End SubPrivate Function saveData() As Boolean Dim UserName As String Dim Password As String Dim Level As Integer saveData = False UserName = Trim() Password = If Len(UserName) = 0 Then MsgBox 請輸入用戶名! Exit Function End If If Len(Password) = 0 Then MsgBox 請輸入密碼! Exit Function End If With theUser .UserName = UserName .Password = Password Select Case Case 1 .Level = 1 Case 2 .Level = 1 Case Else .Level = 0 End Select If .uid = 0 Then saveData = .addData Else saveData = .saveData End If If saveData = False Then MsgBox 保存不成功,請檢查用戶名是否唯一! End WithEnd FunctionPrivate Sub cmdSave_Click() If saveData() = True Then isUpdate = True End If End SubPrivate Sub Form_Load() With cboLevel .AddItem 普通用戶 .AddItem 數(shù)據(jù)操作員 .AddItem 系統(tǒng)管理員 .ListIndex = 0 End With isUpdate = False End SubPublic Sub loadUser(uid As String) 39。數(shù)據(jù)操作員 = 1 Case 1 39。普通用戶 = 0 End Select End With End SubPublic Sub setStatus() If = 0 Then = False Else 39。不允許修改用戶名; End IfEnd Sub:設(shè)備界面代碼設(shè)計:Private Sub cmdCancel_Click() With theDevice If .isDirty Then If MsgBox(你已經(jīng)更改數(shù)據(jù),是否做保存數(shù)據(jù)后再退出?, vbYesNo) = vbYes Then If saveData() = False Then Exit Sub End If End If End If End With End SubPrivate Sub cmdDelete_Click() () isUpdate = True End SubPrivate Sub cmdSave_Click() If saveData() = True Then isUpdate = True End IfEnd 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。 .Fields(TypeName).value .MoveNext Loop End With strSQL = SELECT * FROM tblDepartment ORDER BY DeptNO Set rs = (strSQL) With rs Do Until .EOF .Fields(DeptNO).value amp。 .Fields(Department).value .MoveNext Loop End With Set rs = Nothing isUpdate = False End SubPublic Sub loadDevice(iid As String) 39。 With cboTypeNO For pos = 0 To .ListCount 1 If Left(.List(pos), Len(TypeNo)) = TypeNo Then .ListIndex = pos Exit For End If Next End WithEnd SubPrivate Sub setDeptIndex(DeptNo As String) Dim pos As Integer DeptNo = DeptNo