【正文】
說明: 15 收入項(xiàng)目表的詳細(xì)結(jié)構(gòu)為: 支出項(xiàng)目表的詳細(xì)結(jié)構(gòu)為: 用戶管理表的詳細(xì)結(jié)構(gòu)為: 16 4. 4測試用例 現(xiàn)金日常收支表的測試用例: 信用卡收地表的測試用例: 17 18 第五章 詳細(xì)設(shè)計(jì) 5. 1系統(tǒng)登錄模塊的設(shè)計(jì)與實(shí)現(xiàn) 1.流程圖 2.界面: 界面包括的控件有標(biāo)簽、文本框、命令按鈕等控件。 此窗體上另外還有 Data Text3 二個(gè)控件在程序運(yùn)行時(shí)是看不到的,它們的作用是使 VB與 Access 數(shù)據(jù)庫相連,然后判斷用戶輸入的用戶名與密碼是否與數(shù)據(jù)庫中的一致,如果一致,則允許用戶進(jìn)入系統(tǒng)。 5. 2主界面的設(shè)計(jì)與實(shí)現(xiàn) 主界面是用菜單形式表現(xiàn)的,如圖: 菜單的制作過程如下: 此數(shù)據(jù)控件綁定到何數(shù)據(jù)庫 此數(shù)據(jù)控件綁定到何字段 23 首先通過“工具”菜單中的“菜單編輯器”調(diào)出菜單編輯器,然后進(jìn)行菜單的設(shè)置,如下圖: 此過程中要注意各菜單的名稱唯一,另外還要注意菜單的級(jí)別。 第三步雙擊 相應(yīng)的控件,在控件的相應(yīng)過程中編寫代碼: 的代碼為: Private Sub Command1_Click() = False = False 對(duì)應(yīng)的字段 數(shù)據(jù)源 26 = False = True = True = True = True = True End Sub 的代碼為: Private Sub Command2_Click() If MsgBox(確認(rèn)刪除當(dāng)前記錄嗎? , vbYesNo, 確認(rèn)窗口 ) = vbYes Then = False = False = False = True = False If Then End If End If End Sub 的代碼為: Private Sub Command3_Click() = False = False 27 = False = True = True = True = True = True = True End Sub 的代碼為: Private Sub Command4_Click() = False = False = False = False = True = True = True = False = False End Sub 的代碼為: Private Sub Command5_Click() 28 = False = False = False = False = True = True = True = False = False End Sub 的代碼為: Private Sub Command6_Click() Unload Me End Sub 單選按鈕組的代碼為: Private Sub Option1_Click(index As Integer) If index = 0 Then = True = False = Else = True = False = End If End Sub 29 此窗體上用了 3個(gè) Adodc 控件, Adodc1 用來連接日常收支表, Adodc2 用來連接收入項(xiàng)目表, Adodc3 用來連接支出項(xiàng)目表。 下面把此界面的主要代碼作一介紹: 按鈕的代碼如下: Private Sub Command1_Click() Dim strQuery As String = False = True N Y 開始 設(shè)置查詢條件查詢 是否繼續(xù) 退出 31 = True d1 = Trim() d2 = Trim() = adCmdText If = True Then strQuery = select * from 日常收支 where len(收入項(xiàng)目 ) and 日期 =39。 And 日期 = 39。 End If If = True Then strQuery = select * from 日常收支 where len(支出項(xiàng)目 ) and 日期 =39。 And 日期 = 39。 End If If = False And = False Then strQuery = select * from 日常收支 where 日期 =39。 And 日期 = 39。 End If = strQuery If = 0 Then MsgBox 不存在此時(shí)間段的收支記錄 ! End If End Sub 此過程主要是借助于 SQL(結(jié)構(gòu)化查詢語言)語句來進(jìn)行查詢,并通過 Option 按鈕組判斷用戶選擇的查詢方式。表格的主要屬性為: 32 “現(xiàn)金余額”的代碼為: Private Sub Command4_Click() c = For n = 1 To c If Len((收入項(xiàng)目 )) Then a = a + (金額 ) Else b = b + (金額 ) End If Next MsgBox 收入為: amp。 Chr(13) + 現(xiàn)金余額為: amp。如下圖: 第二步,選擇窗體或控件進(jìn)行屬性設(shè)置,如圖為窗體的屬性設(shè)置界面 : 36 其它屬性和控件的設(shè)置方法類似。 下面把此界面的主要代碼作一介紹: 按鈕的代碼如下: Private Sub Command1_Click() Dim strQuery As String d1 = Trim() d2 = Trim() = adCmdText If = True Then strQuery = select * from 卡日常收支 where len(收入項(xiàng)目 ) and 日期 =39。 And 日期 = 39。 End If If = True Then 43 strQuery = select * from 卡日常收支 where len(支出項(xiàng)目 ) and 日期 =39。 And 日期 = 39。 End If If = False And = False Then strQuery = select * from 卡日常收支 where 日期 =39。 And 日期= 39。 End If = strQuery If = 0 Then MsgBox 不存在此時(shí)間段的收支記錄 ! End If End Sub 查詢過程主要是借助于 SQL(結(jié)構(gòu)化查詢語言)語句來進(jìn)行查詢,并通過 Option 按鈕組判斷用戶選擇的查詢方式。 a amp。 Str(a b), , 系統(tǒng)統(tǒng)計(jì) End Sub 統(tǒng)計(jì)結(jié)果如下圖: 實(shí)現(xiàn)卡上的收入、支出及余額的統(tǒng)計(jì)。 JET 數(shù)據(jù)引擎 6. 3運(yùn)行結(jié)果 圖 登錄界面 47 圖 系統(tǒng)主界面 圖 現(xiàn)金收支管理界面 48 圖 現(xiàn)金收支查詢界面 圖 信用卡收支管理界面 49 圖 信用卡收支查詢界面 圖 收入 /支出項(xiàng)目維護(hù)界面 圖 密碼修改界面 50 第七章 設(shè)計(jì)心得 經(jīng)過三個(gè)多月的設(shè)計(jì)和開發(fā),家庭理財(cái)管理系統(tǒng)基本開發(fā)完