i have 3 forms
FrmInventory , FrmCashregister , FrmItems
this are the values of each table
FrmItems dosnt have a table only a listview that pulls some values from the Frminventory
this is the code
i want to know if there is a way if i sale something then the remain quantity will show in the FrmItems form and not in the FrmInventory form
and this is the code when i sell something to a customer
if any information is needed i will add here
regards salsa31
FrmInventory , FrmCashregister , FrmItems
this are the values of each table
Code:
Form (FrmInventory)
Table Name - Inventory
InvID - Long
InvDate - Date/Time
InvItem - Text
InvQuantity - Currency
InvBeforeTax - Currency
InvInvoice - Text
InvSupplier - Text
InvEmail - Text
InvPhone - Text
InvBranch - Text
InvFax - Text
InvCompany - Text
InvPaymentMethod - Text
InvPayments - Text
InvParts - Text
InvExpire - Date/Time
InvTax - Currency
InvAfterTax - Currency
InvForCust -Text
InvTotal - Currency
InvPhoto - Text
InvStatus - Text
InvRemarks - Text
Code:
Form (FrmCashRegister)
Table name CashBox
CashID value Long
CashNameEmp Value Text
CashDate Value Text
CashDay value text
CashTime value text
CashCust value text
CashItem value text
CashPartNumber value text
CashQuantity value Currency
CashPrice value Currency
CashDiscount value currency
CashTotal value currency
CashMethod value text
CashPayments value currency
CashRemarks value text
this is the code
Code:
Set rs = CN.Execute("SELECT * from Inventory ")
While Not rs.EOF
Set itm = frmItems.LsVw.ListItems.Add(, , rs!InvDate, , "prd")
itm.bold = True
itm.SubItems(1) = rs!InvParts
itm.SubItems(2) = rs!InvItem
itm.SubItems(3) = rs!InvRemarks
rs.MoveNext
Wend
and this is the code when i sell something to a customer
Code:
Private Sub BttnSave_Click()
If NewRec Then
Dim NewID As Long
NewID = NextID("CashID", "CashBox")
Dim strSQL As String
strSQL = "INSERT INTO CashBox "
strSQL = strSQL & "(CashID, CashNameEmp, CashDate, CashDay, CashTime, CashCust, CashItem, CashPartNumber, CashQuantity, CashPrice, CashDiscount, CashTotal, CashMethod, CashPayments, CashRemarks) "
strSQL = strSQL & "VALUES("
strSQL = strSQL & NewID & ","
strSQL = strSQL & "'" & RplS(CmbName.text) & "',"
strSQL = strSQL & "#" & MyDate(PickDate.Value) & "#,"
strSQL = strSQL & "'" & RplS(Txt(1).text) & "',"
strSQL = strSQL & "'" & RplS(Txt(2).text) & "',"
strSQL = strSQL & "'" & RplS(TxtDesc.text) & "',"
strSQL = strSQL & "'" & RplS(Txt(4).text) & "',"
strSQL = strSQL & "'" & RplS(Txt(5).text) & "',"
strSQL = strSQL & CCur(Txt(6).text) & ","
strSQL = strSQL & CCur(Txt(7).text) & ","
strSQL = strSQL & CCur(Txt(8).text) & ","
strSQL = strSQL & CCur(Txt(9).text) & ","
strSQL = strSQL & "'" & CmbMethod.text & "',"
strSQL = strSQL & CCur(CmbPay.text) & ","
strSQL = strSQL & "'" & RplS(Txt(10).text) & "'"
strSQL = strSQL & ")"
CN.Execute strSQL
'strSQL = "UPDATE Inventory SET InvRemain = InvRemain - " & Txt(6).text & " WHERE InvParts = '" & RplS(Txt(5).text) & "'"
Set itm = FrmCashRegister.LsVw.ListItems.Add(, , CmbName.text, , "cash")
itm.Tag = NewID
itm.SubItems(1) = Replace$(PickDate.Value, ",", ".")
itm.SubItems(2) = Replace$(Txt(1).text, ",", ".")
itm.SubItems(3) = Replace$(Txt(2).text, ",", ".")
itm.SubItems(4) = Replace$(TxtDesc.text, ",", ".")
itm.SubItems(5) = Replace$(Txt(4).text, ",", ".")
itm.SubItems(6) = Replace$(Txt(5).text, ",", ".")
itm.SubItems(7) = Replace$(Txt(6).text, ",", ".")
itm.SubItems(8) = Replace$(Txt(7).text, ",", ".")
itm.SubItems(9) = Replace$(Txt(8).text, ",", ".")
itm.SubItems(10) = Replace$(Txt(9).text, ",", ".")
itm.SubItems(11) = Replace$(CmbMethod.text, ",", ".")
itm.SubItems(12) = Replace$(CmbPay.text, ",", ".")
itm.SubItems(13) = Replace$(Txt(10).text, ",", ".")
If ChkRepeat.Value Then
PickDate.Value = Now
Txt(1).text = Format(Now, "dddd")
Txt(2).text = Format(Now, "HH:MM:SS")
TxtDesc.text = ""
Txt(4).text = ""
Txt(5).text = ""
Txt(6).text = ""
Txt(7).text = ""
Txt(8).text = ""
Txt(9).text = ""
Txt(10).text = ""
CmbName.ListIndex = -1
CmbMethod.ListIndex = -1
CmbItem.ListIndex = -1
CmbPay.ListIndex = -1
CmbDiscount.ListIndex = -1
ChkRepeat.Value = 0
Chk.Value = vbUnchecked
Exit Sub
End If
Else
With FrmCashRegister.LsVw.SelectedItem
strSQL = "UPDATE CashBox SET "
strSQL = strSQL & "CashNameEmp = '" & RplS(CmbName.text) & "',"
strSQL = strSQL & "CashDate = #" & MyDate(PickDate.Value) & "#,"
strSQL = strSQL & "CashDay = '" & RplS(Txt(1).text) & "',"
strSQL = strSQL & "CashTime = '" & RplS(Txt(2).text) & "',"
strSQL = strSQL & "CashCust = '" & RplS(TxtDesc.text) & "',"
strSQL = strSQL & "CashItem = '" & RplS(Txt(4).text) & "',"
strSQL = strSQL & "CashPartNumber = '" & RplS(Txt(5).text) & "',"
strSQL = strSQL & "CashQuantity = " & CCur(Txt(6).text) & ","
strSQL = strSQL & "CashPrice = " & CCur(Txt(7).text) & ","
strSQL = strSQL & "CashDiscount = " & CCur(Txt(8).text) & ","
strSQL = strSQL & "CashTotal = " & CCur(Txt(9).text) & ","
strSQL = strSQL & "CashMethod = " & CCur(CmbMethod.text) & ","
strSQL = strSQL & "CashPayments = " & CCur(CmbPay.text) & ","
strSQL = strSQL & "CashRemarks = '" & RplS(Txt(10).text) & "'"
strSQL = strSQL & " WHERE CashID = " & .Tag
CN.Execute strSQL
CmbName.text = Trim(.SubItems(1))
PickDate.Value = .SubItems(2)
Txt(1).text = .SubItems(3)
Txt(2).text = .SubItems(4)
TxtDesc.text = .SubItems(5)
Txt(4).text = .SubItems(6)
Txt(5).text = .SubItems(7)
Txt(6).text = .SubItems(8)
Txt(7).text = .SubItems(9)
Txt(8).text = .SubItems(10)
Txt(9).text = .SubItems(11)
CmbPay.text = Trim(.SubItems(13))
Txt(10).text = .SubItems(14)
End With
End If
Unload Me
Call FrmCashRegister.Loadinv
End Sub
regards salsa31