【正文】
rdset Private Sub cmdAdd_Click() Dim count As Integer, i As Integer Dim SQLstring As String Dim mrc As Recordset, mrcc As Recordset Dim Num As Integer, price As Single If = Then MsgBox 進庫單號碼不能為空 , 請?zhí)顚?! , vbOKOnly + vbExclamation, 警告 Exit Sub End If While = False If (進庫單號碼 ) = Then MsgBox 此進庫單號碼已經(jīng)存在,請認真核查! , vbOKOnly + vbExclamation, 警告 = = = = = Exit Sub Else End If Wend If = Then MsgBox 發(fā)票號碼不能為空,請?zhí)顚懀?, vbOKOnly + vbExclamation, 警告 Exit Sub End If If = Then MsgBox 進庫日期不能為空,請?zhí)顚懀?, vbOKOnly + vbExclamation, 警告 北京理工大學(xué) 現(xiàn)代遠程教育 學(xué)院畢業(yè)設(shè)計 (論文 ) 第 29頁 Exit Sub Else If IsDate() Then Text3 = Format(Text3, yyyymmdd) Else MsgBox 進庫時間格式應(yīng)為: yyyymmdd, vbOKOnly + vbExclamation, 警告 = Exit Sub End If End If If 1 Then (進庫單號碼 ) = (發(fā)票號碼 ) = (進庫日期 ) = If = Then (經(jīng)辦人 ) = Null Else (經(jīng)辦人 ) = End If If = Then (保管人 ) = Null Else (保管人 ) = End If count = For i = 1 To (count 1) (進庫單號碼 ) = (材料編碼 ) = (i, 0) (數(shù)量 ) = Val((i, 4)) If (i, 5) = Then (單價 ) = Null Else (單價 ) = Val((i, 5)) End If (金額 ) = Val((i, 6)) If (i, 7) = Then (備注 ) = Null Else (備注 ) = (i, 7) End If SQLstring = select * from msurplus where 材料編碼 =39。 amp。 (i, 0) amp。 39。 Set mrc = (SQLstring) 39。如果材料余額表中沒有當前材料編碼的記錄,就添加 北京理工大學(xué) 現(xiàn)代遠程教育 學(xué)院畢業(yè)設(shè)計 (論文 ) 第 30頁 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。 (i, 0) amp。 39。 (SQLstring) Next i Unload Me (1).Text = 就緒 Exit Sub Else MsgBox 進庫單中必須至少包含一項材料明細。 amp。 vbCrLf amp。 此進庫單中未填寫材料信息,請?zhí)顚憽?, vbOKOnly + vbExclamation, 警告 Exit Sub End If End Sub Private Sub cmdAddRecord_Click() (1).Text = 添加進庫信息 1 End Sub Private Sub cmdCancel_Click() = = = = = End Sub 北京理工大學(xué) 現(xiàn)代遠程教育 學(xué)院畢業(yè)設(shè)計 (論文 ) 第 31頁 Private Sub cmdClose_Click() Unload Me (1).Text = 就緒 End Sub Private 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 北京理工大學(xué) 現(xiàn)代遠程教育 學(xué)院畢業(yè)設(shè)計 (論文 ) 第 32頁 = 1 If = 1 Then = False End If End If End If End Sub Private 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 Sub Private Sub Form_Activate() (1).Text = 添加進庫單 End Sub Private Sub Form_Load() = 8 = 1 = 0 = 0 = 材料編碼 = 1 = 材料名稱 = 2 = 規(guī)格型號 = 3 = 計量單位 = 4 = 數(shù)量 = 5 = 單價 = 6 = 金額 = 7 北京理工大學(xué) 現(xiàn)代遠程教育 學(xué)院畢業(yè)設(shè)計 (論文 ) 第 33頁 = 備注 = False = False = False = Date Set Myws = (0) Set Mydb = ( + \) Set Myrs1 = (select * from inlib) Set Myrs2 = (select * from inlibdetail) End Sub Private Sub Frame1_DragDrop(Source As Control, X As Single, Y As Single) End Sub Private Sub MSFlexGrid1_Click() Dim c As Integer Dim r As Integer With MSFlexGrid1 c = .Col r = .Row = + (c) = + (r) If