vbcielle 0 Light Poster

i have a search program that when searched i will make a receipt, a reciept form will be displayed, the
1st item searched will be displayed on text1(0).text and the quantity also will be displayed in text5(0).text
my problem is how to subtract the stock items minus the quantity text5(0).text(its an array of text5(i).text
in frmsearch i have this for a code:

repeat = 1
 
If Adodc1.Recordset.RecordCount > 0 Then
Ono1 = Adodc1.Recordset.Fields("Price")
Ono2 = Adodc1.Recordset.Fields("Carmodel")
Ono6 = Adodc1.Recordset.Fields("Category")
Ono3 = Adodc1.Recordset.Fields("PartNo2")
Ono4 = Adodc1.Recordset.Fields("CarApp")
Ono5 = Adodc1.Recordset.Fields("Year")
stock = Adodc1.Recordset.Fields("Stocks")
For i = 0 To 4
If repeat = 1 Then
Do While frmReciept.Text4(i).Text = "" And frmReciept.Text6(i).Text = ""
 
frmReciept.Text4(i).Text = Ono2 & " " & Ono6 & " " & Ono3 & " " & Ono4 & " " & Ono5
repeat = 0
frmReciept.Text6(i).Text = Ono1
frmReciept.Text5(i).Text = 1
Loop
End If
Next i
End If
 
frmReciept.Show

in frmReciept i have this for a code

frmReciept.Adodc3.ConnectionString = "Provider=Microsoft.jet.oledb.4.0;data source=" & App.Path & "\MBMKDbase.mdb"
frmReciept.Adodc3.RecordSource = "SELECT * FROM CustDbase"
frmReciept.Adodc3.CommandType = adCmdText
frmReciept.Adodc3.Refresh
 
If frmReciept.Text4(i).Text <> "" And frmReciept.Text6(i).Text <> "" Then
 
With frmReciept.Adodc3.Recordset
.AddNew
.Fields("CustName") = frmReciept.Combo6.Text
.Fields("InvoiceNo") = frmReciept.Text8.Text
.Fields("PONo") = frmReciept.Text10.Text
.Fields("Date") = frmReciept.txtDate.Text
.Fields("QtY") = frmReciept.Text5(i).Text
.Fields("Product") = Label17.Caption & "," & Label18.Caption 'Text4(i).Text
.Fields("Price") = frmReciept.Text6(i).Text
.Fields("Total") = frmReciept.Text3.Text
.Update
End With
End If

i want that everytime i add a product in the receipt, the stocks of that particular item will deducted with the quantity purchased
(frmReciept.Text5(i).Text) can anyone help :(

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.