i created form that sells treatments and the history to save it
now a customer comes along and buys 12 treatments for 120 Euro
each time he comes to the salon to do a treatment that he paid for
i reduce 1 of the 12 that he buy.
when i enter for the first time a new cust with new treatment the i see it in the history aslo
when i go back to the same cust and update 1 treatment
then in the history it creates the same thing as this is a new customer and not updating correct.
i am a little lost here
this is my code
any help i appriciate
salsa31
now a customer comes along and buys 12 treatments for 120 Euro
each time he comes to the salon to do a treatment that he paid for
i reduce 1 of the 12 that he buy.
when i enter for the first time a new cust with new treatment the i see it in the history aslo
when i go back to the same cust and update 1 treatment
then in the history it creates the same thing as this is a new customer and not updating correct.
i am a little lost here
this is my code
Code:
If NewRec Then
Dim NewID As Long
NewID = NextID("ID", "Subscribers")
strSQL = "INSERT INTO Subscribers "
strSQL = strSQL & "(ID, SubEmpName, SubDate, SubCust, SubTreatment, SubQuantity, SubSold, SubRemain, SubPaymentMethod, SubPrice, SubTashlomim, SubTotal) "
strSQL = strSQL & "VALUES("
strSQL = strSQL & NewID & ","
strSQL = strSQL & "'" & RplS(CmbName.Text) & "',"
strSQL = strSQL & "#" & MyDate(DTstart.Value) & "#,"
strSQL = strSQL & "'" & RplS(TxtDesc.Text) & "',"
strSQL = strSQL & "'" & RplS(CmbTreat.Text) & "',"
strSQL = strSQL & CCur(Txt(0).Text) & ","
strSQL = strSQL & "0,"
strSQL = strSQL & CCur(Txt(0).Text) & ","
strSQL = strSQL & "'" & RplS(CmbPayMethod.Text) & "',"
strSQL = strSQL & CCur(Txt(1).Text) & ","
strSQL = strSQL & CCur(CmbTashlomim.Text) & ","
strSQL = strSQL & CCur(Txt(2).Text) & ""
strSQL = strSQL & ")"
CN.Execute strSQL
Code:
With FrmSubscribe.LsVw.SelectedItem
strSQL = "UPDATE Subscribers SET "
strSQL = strSQL & "SubDate = #" & MyDate(DTstart.Value) & "#"
CN.Execute strSQL
strSQL = "Update Subscribers set SubSold = SubSold + " & RplS(txtPick & ",")
strSQL = strSQL & " SubRemain = SubRemain - " & RplS(txtPick.Text)
strSQL = strSQL & " where ID = " & .Tag
CN.Execute strSQL
End With
End If
Code:
NewID = NextID("ID", "SubHistory")
strSQL = "INSERT INTO SubHistory "
strSQL = strSQL & "(ID,SubHistName,SubHistDate,SubHistCust,SubHistTreatment,SubHistQuantity,SubHistSold,SubHistRemain,SubHistPaymentMethod,SubHistPrice,SubHistTashLomim,SubHistTotal)"
strSQL = strSQL & "VALUES("
strSQL = strSQL & NewID & ","
strSQL = strSQL & "'" & RplS(CmbName.Text) & "',"
strSQL = strSQL & "#" & MyDate(DTstart.Value) & "#,"
strSQL = strSQL & "'" & RplS(TxtDesc.Text) & "',"
strSQL = strSQL & "'" & RplS(CmbTreat.Text) & "',"
strSQL = strSQL & CCur(Txt(0).Text) & ","
strSQL = strSQL & "0,"
strSQL = strSQL & CCur(Txt(0).Text) & ","
'strSQL = strSQL & "'" & RplS(txtPick.text) & "',"
'strSQL = strSQL & "'" & RplS(TxtWorked.text & "',")
'strSQL = strSQL & "0,"
'strSQL = strSQL & "'" & RplS(TxtRemain.text) & "',"
strSQL = strSQL & "'" & RplS(CmbPayMethod.Text) & "',"
strSQL = strSQL & CCur(Txt(1).Text) & ","
strSQL = strSQL & RplS(CmbTashlomim.Text) & ","
strSQL = strSQL & CCur(Txt(2).Text) & ""
strSQL = strSQL & ")"
CN.Execute strSQL
'' strSQL = "UPDATE SubHistory SET "
''strSQL = strSQL & "SubDate = #" & MyDate(DTstart.Value) & "#"
''CN.Execute strSQL
strSQL = "Update SubHistory set SubHistSold = SubHistSold + " & RplS(txtPick & ",")
strSQL = strSQL & " SubHistRemain = SubHistRemain - " & RplS(txtPick.Text)
strSQL = strSQL & " where ID = " & .Tag' error invaild qualified some thing like that
CN.Execute strSQL
salsa31