【文章內容簡介】
。 While ccbh jhbh And Not ccbh = (商品編號).Value If ccbh = jhbh Then ccbh = (商品編號).Value Else End If Wend If ccbh = jhbh Then field_value = (數量).Value (數量).Value = field_value + txtliang_value Else 39。添加新記錄 With .AddNew .Fields(商品編號).Value = jhbh .Fields(商品名稱).Value = jhna .Fields(數量).Value = txtliang_value .Update End With End If 39。返回開單,重新綁定字段 = 進貨記錄 = 商品名稱 = 數量 = 單價 = 商品編號 = 操作日期 = 金額 = 廠家名稱 = 業(yè)務員名稱 = 0 End If Exit Sub err: = 0 MsgBox End Sub Private Sub cmdquit_Click() Unload Me End Sub Private Sub Form_Load() With Data1 .DatabaseName = amp。 .RecordSource = 進貨記錄 End With 39。數據庫中表進貨記錄中的內容如下 = 商品名稱 = 數量 = 單價 = 商品編號 = 操作日期 = 金額 = 廠家名稱 = 業(yè)務員名稱 = 支付方式 Call addcj39。添加廠家名稱 Call addywy 39。添加業(yè)務員名稱 End Sub Private Sub txtdanjia_GotFocus() With txtdanjia .SelStart = 0 .SelLength = Len(.Text) End With End Sub Private Sub txtdanjia_KeyPress(KeyAscii As Integer) 39。只能輸入數字 If (KeyAscii 48 Or KeyAscii 57) And KeyAscii = 32 _ And KeyAscii Asc(.) Then KeyAscii = 0 Beep End If End Sub Private Sub txtliang_GotFocus() With txtliang .SelStart = 0 .SelLength = Len(.Text) End With End Sub Private Sub txtliang_KeyPress(KeyAscii As Integer) If (KeyAscii 48 Or KeyAscii 57) And KeyAscii = 32 _ And KeyAscii Asc(.) Then KeyAscii = 0 Beep End Sub Private Sub txtliang_LostFocus() On Error GoTo err If txtdanjia And txtliang Then = txtdanjia * txtliang Else MsgBox 字段不能為空, vbExclamation, Error End If Exit Sub err: MsgBox 請確認數據的正確性, vbCritical, 錯誤 End Sub Private Sub txtshui_LostFocus() Dim shui 39。計算稅額 If txtjine And txtshui Then shui = 1 ( / 100) = shui * txtjine End If End Sub 二:銷售管理 銷售管理與進貨管理模塊中記錄的操作大體一致,所不同的是庫存的增減,還要添加兩個功能:查找商品(見frmfindsp)及檢測庫存量 說明:此處textbox控件:txtspbh 顯示商品編號、txtstore 顯示當前庫存量 Private Sub Cmdfindsp_Click() 39。查找商品,代碼請參考“查找商品” 1