【正文】
= 39。) Do While Not = + 1 = 1 = 0 = (進庫單號碼) = 1 = (進庫日期) Loop End If If = True Then If = Then MsgBox 請?zhí)顚懘舜尾樵兊倪M庫日期開始時間!, vbOKOnly + vbExclamation, 警告 Exit Sub End If If = Then MsgBox 請?zhí)顚懘舜尾樵兊倪M庫日期結束時間!, vbOKOnly + vbExclamation, 警告 Exit Sub End If = 1 (0, 0) = 進庫單號碼 (0, 1) = 進庫日期 Set myrecordset = (select * from inlib where 進庫日期= amp。, vbOKOnly + vbExclamation, 警告 Exit Sub End IfEnd SubPrivate Sub cmdAddRecord_Click() (2).Text = 添加進庫信息 1 End SubPrivate Sub cmdCancel_Click() = = = = = End SubPrivate Sub cmdClose_Click() Unload Me (2).Text = 就緒End SubPrivate Sub cmdDelRecord_Click() Dim i As Integer, j As Integer = False If 1 Then If MsgBox(確認要刪除這條記錄嗎?, vbOKCancel + vbExclamation, 警告) = vbOK Then i = = (i, 0) = (i, 0) = = (i, 1) = (i, 1) = = (i, 2) = (i, 2) = = (i, 3) = (i, 3) = = (i, 4) = (i, 4) = = (i, 5) = (i, 5) = = (i, 6) = (i, 6) = = (i, 7) = (i, 7) = For j = i To ( 2) (j, 0) = (j + 1, 0) (j, 1) = (j + 1, 1) (j, 2) = (j + 1, 2) (j, 3) = (j + 1, 3) (j, 4) = (j + 1, 4) (j, 5) = (j + 1, 5) (j, 6) = (j + 1, 6) (j, 7) = (j + 1, 7) Next j = 1 If = 1 Then = False End If End If End IfEnd SubPrivate Sub cmdEditRecord_Click() Dim c As Integer Dim r As Integer c = 1 r = 1 = + (c) = + (r) If = 1 Then = + 2 * = + 2 * End If = (c) = (r) = True = End SubPrivate Sub Form_Activate() (2).Text = 添加進庫單End SubPrivate Sub Form_Load() = 8 = 1 = 0 = 0 = 材料編碼 = 1 = 材料名稱 = 2 = 規(guī)格型號 = 3 = 計量單位 = 4 = 數(shù)量 = 5 = 單價 = 6 = 金額 = 7 = 備注 = False = False = False = Date Set Myws = (0) Set Mydb = ( + \) Set Myrs1 = (select * from inlib) Set Myrs2 = (select * from inlibdetail)End SubPrivate Sub MSFlexGrid1_Click() Dim c As Integer Dim r As Integer With MSFlexGrid1 c = .Col r = .Row = + (c) = + (r) If .Appearance = 1 Then = + 2 * = + 2 * End If = .ColWidth(c) = .RowHeight(r) = .Text End With = True End SubPrivate Sub MSFlexGrid1_Scroll() = FalseEnd SubPrivate Sub Text1_Change() = TrueEnd SubPrivate Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = 13 Then End IfEnd SubPrivate Sub Text2_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = 13 Then End IfEnd SubPrivate Sub Text3_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = 13 Then End IfEnd SubPrivate Sub Text4_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = 13 Then End IfEnd SubPrivate Sub Text5_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = 13 Then End IfEnd SubPrivate Sub Text6_Change() = End SubPrivate Sub Text6_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then = False End IfEnd SubPrivate Sub Text6_LostFocus() = FalseEnd Sub:代碼分析:Option ExplicitDim Mydb As DatabaseDim myrecordset As RecordsetPrivate Sub Command1_Click() If = True Then = 1 (0, 0) = 進庫單號碼 (0, 1) = 進庫日期 Set myrecordset = (select * from inlib where 進庫單號碼=39。 (SQLstring) Next i Unload Me (2).Text = 就緒 Exit Sub Else MsgBox 進庫單中必須至少包含一項材料明細。如果材料余額表中沒有當前材料編碼的記錄,就添加 If = True Then SQLstring = select * from msurplus Set mrcc = (SQLstring) (材料編碼) = (i, 0) (數(shù)量) = 0 If (i, 5) = Then (單價) = Null Else (單價) = (i, 5) End If (金額) = 0 (備注) = Null Else End If Num = Val((i, 4)) price = Val((i, 6)) SQLstring = update msurplus set 數(shù)量=數(shù)量+ + CStr(Num) + ,金額=金額+ + CStr(price) + where 材料編碼=39。 amp。將從一個或多個表中檢索數(shù)據(jù),并使用用戶在“窗體向導”選擇的版面布局或所創(chuàng)建的版面布局,將窗體顯示在屏幕上。查詢的同時也可以更新或刪除多條記錄,并對數(shù)據(jù)執(zhí)行內嵌或自定義的計算。在這個文件中,用戶可以將自己的數(shù)據(jù)分別保存在各自獨立的存儲空間中,這些空間稱作表;可以使用聯(lián)機窗體來查看、添加及更新表中的數(shù)據(jù);使用查詢來查找并檢索所要的數(shù)據(jù);也可以使用報表以特定的版面布置來分析及打印數(shù)據(jù)。Microsoft在數(shù)據(jù)庫發(fā)展的歷史上,最重要的成就就是關系模型。注意:請將庫文件存入程序所在目錄。2) Enable屬性:為true時(缺省值),激活定時器開始計時。2) Max和min屬性:對value值的最大,最小進行限制。5) OLECompleteDrag事件:當源部件被放到目標時發(fā)生,并通知源部件拖放操作被執(zhí)行或取消。u 復選按鈕類的控件的基本事件:1) Click事件:鼠標單擊控件時發(fā)生。12) DragMode屬性:設置返回一個值,確定在拖放操作中所用方式。8) Datasource屬性:設置或返回控件綁定的一個數(shù)據(jù)源。