【正文】
End If Else Unload Me End If End If pwdcount = pwdcount + 1 If pwdcount = 3 Then MsgBox 錯(cuò)誤輸入已達(dá)3次,系統(tǒng)退出!, vbOKOnly + vbExclamation, 警告 Unload Me Exit Sub End IfEnd Sub‘定義輸入次數(shù)的初值為0.Private Sub Form_Load() pwdcount = 0End SubPrivate Sub loginCancel_Click() ‘退出按鈕 EndEnd Sub點(diǎn)擊求助按鈕會(huì)彈出如下界面:Private Sub Command1_Click() ‘求助按鈕 End Sub二、 主界面主界面提供向各種功能界面的鏈接,包括四個(gè)下拉菜單和五個(gè)快捷方式按鈕。其中需要注意的是,在登錄時(shí)系統(tǒng)通過(guò)一個(gè)全局變量記錄下來(lái)登錄用戶的用戶類(lèi)型,在這里將會(huì)進(jìn)行判斷,如果是普通用戶將使一些按鈕反白。Private Sub Command1_Click() Unload Me End SubPrivate Sub Command2_Click() Unload Me End SubPrivate Sub Command3_Click() Unload Me End SubPrivate Sub Command4_Click() Unload Me End SubPrivate Sub Command6_Click() EndEnd SubPrivate Sub MDIForm_Load()Dim usertype2 As String usertype2 = usertype If usertype2 0 Then ‘判斷用戶類(lèi)型 = False = False = False = False End IfEnd SubPrivate Sub 關(guān)于_Click() End SubPrivate Sub 借出查詢_Click() Unload Me End SubPrivate Sub 使用指南_Click() End SubPrivate Sub 添加借出信息_Click() Unload Me End SubPrivate Sub 添加用戶_Click() Unload Me End SubPrivate Sub 退出_Click() EndEnd SubPrivate Sub 修改密碼_Click() Unload Me End SubPrivate Sub 資產(chǎn)查詢_Click() Unload Me End SubPrivate Sub 資產(chǎn)借出列表_Click() Unload Me End SubPrivate Sub 資產(chǎn)列表_Click() Unload Me End SubPrivate Sub 資產(chǎn)添加_Click() Unload Me End Sub三、修改密碼修改密碼的功能要求在已知所要修改密碼的用戶名和密碼才允許進(jìn)行。Private Sub reset_Click() ‘重置 = = = = End SubPrivate Sub modifySure_Click() Dim rs As New Dim rs2 As New Dim sql As String Dim sql2 As String sql = select * from 用戶表 where 用戶名=39。 amp。 amp。 39。and 用戶密碼=39。 amp。 amp。 39。 Set rs = TransactSQL(sql) If = True Then MsgBox 用戶密碼不匹配,無(wú)權(quán)更改!, vbOKOnly + vbExclamation, 警告 Else If Then MsgBox 兩次輸入密碼不同!, vbOKOnly Else sql2 = select * from 用戶表 where 用戶名=39。 amp。 amp。 39。 Set rs2 = TransactSQL(sql) (1) = MsgBox 密碼修改成功!, vbOKOnly, 修改密碼 End If End IfEnd SubPrivate Sub return_Click() Unload Me End Sub三、 添加用戶添加用戶的功能僅限于管理員,普通用戶無(wú)法進(jìn)行。用戶名要求是唯一的,當(dāng)新用戶名與已有用戶重復(fù)時(shí)不允許添加。Private Sub addUserSure_Click() Dim rs As New Dim sql As String Dim sql2 As String sql = select * from 用戶表 sql2 = select * from 用戶表 where 用戶名=39。 amp。 amp。 39。 If Trim() = Or Trim() = Or Trim() = Then MsgBox 用戶名和密碼不能為空!, vbOKOnly Else Set rs = TransactSQL(sql2) If = False Then MsgBox 該用戶已經(jīng)存在!, vbOKOnly + vbExclamation, 提示 Exit Sub Else If Then MsgBox 兩次輸入密碼不同!, vbOKOnly Else Set rs = TransactSQL(sql) 39。添加新紀(jì)錄 (0) = Trim() (1) = Trim() If = True Then (2) = 0 Else (2) = 1 End If MsgBox 用戶添加成功!, vbOKOnly End If End If End IfEnd SubPrivate Sub reset_Click() = = = = False = FalseEnd SubPrivate Sub return_Click() Unload Me End Sub四、 資產(chǎn)列表資產(chǎn)列表界面顯示所有資產(chǎn)的情況,也是進(jìn)行資產(chǎn)修改和刪除的通道。通過(guò)過(guò)程序?qū)?shù)據(jù)表中相關(guān)的字段與控件MSFlexGrid相綁定,完成修改或刪除后自動(dòng)將結(jié)果保存。Public Function assetmentList_update() Dim rs As New Dim sql As String sql = select * from 資產(chǎn)狀態(tài)表 Dim i As Integer Set rs = TransactSQL(sql) With assetmentInfoGrid .Rows = 1 While Not .Rows = .Rows + 1 .TextMatrix(.Rows 1, 0) = rs(0) .TextMatrix(.Rows 1, 1) = rs(1) .TextMatrix(.Rows 1, 2) = rs(2) .TextMatrix(.Rows 1, 3) = rs(3) .TextMatrix(.Rows 1, 4) = rs(4) .TextMatrix(.Rows 1, 5) = rs(5) .TextMatrix(.Rows 1, 6) = rs(6) .TextMatrix(.Rows 1, 7) = rs(7) .TextMatrix(.Rows 1, 8) = rs(8) .TextMatrix(.Rows 1, 9) = rs(9) Wend End WithEnd FunctionPrivate Sub assetmentInfoGrid_Click() Dim i As Integer 39。首先獲得選定的行號(hào) i = 39。將選定行的內(nèi)容在文本框中顯示 = (i, 0)End SubPrivate Sub Command1_Click() Unload Me End Sub Private Sub Command2_Click() Dim rs As New Dim sql As String sql = select * from 資產(chǎn)狀態(tài)表 where 編號(hào) =39。 amp。 amp。 39。 If Trim() = Then MsgBox 請(qǐng)輸入或在列表中選定要修改的資產(chǎn)編號(hào)!, vbOKOnly Else Set rs = TransactSQL(sql) If = True Then MsgBox 沒(méi)有該編號(hào)的資產(chǎn)信息!, vbOKOnly Else ModifyBkFlag1 = ModifyBkFlag2 = True End If End IfEnd SubPrivate Sub Command3_Click() Dim resMsg As String Dim rs As New Dim sql As String Dim sql2 As String sql = select 編號(hào) from 資產(chǎn)狀態(tài)表 where 編號(hào) = 39。 amp。 amp。 39。 sql2 = delete from 資產(chǎn)狀態(tài)表 where 編號(hào) = 39。 amp。 amp。 39。 If Trim() = Then MsgBox 請(qǐng)選擇或輸入要?jiǎng)h除的資產(chǎn)的編號(hào)!, vbOKOnly Else Set rs = TransactSQL(sql) If = True Then MsgBox 沒(méi)有該編號(hào)的資產(chǎn)信息!, vbOKOnly Else resMsg = MsgBox(真的要?jiǎng)h除該編號(hào)的資產(chǎn)信息嗎?, vbOKCancel, 警告) If resMsg = vbOK Then TransactSQL (sql2) MsgBox 該編號(hào)的資產(chǎn)信息已經(jīng)刪除!, vbOKOnly Call assetmentList_update End If End If End IfEnd SubPrivate Sub Command4_Click() Unload Me End SubPrivate Sub Command5_Click() Unload Me End SubPrivate Sub Form_Activate() Call assetmentList_updateEnd SubPrivate Sub Form_Load() ‘如果用戶類(lèi)型為普通用戶將令幾個(gè)按鈕成反白。 Dim usertype2 As String usertype2 = usertype If usertype2 0 Then = False = False = False End If Wit