i have problem with update !!!

Dlovan-IT

Registered User.
Local time
Today, 10:18
Joined
Oct 9, 2013
Messages
84
hello all

i have a database all the tables is connected with the sql server and i have 2 tables the first one is like that :

Name of Table : dbo_tbl_debthimself
====================
Code | qty | price | Total
====================

and the second once is like that :

Name of Table : dbo_tbl_edit_money
===============
Code | price | date
===============

i make the form for the second table i want to calculate the price lest's say when the user input the code and price from dbo_tbl_edit_money it will be calculate with the total from dbo_tbl_debthimself lets say : the our total is is (1000) when the user input the price form dbo_tbl_edit_money it will be like this : price - total
and this is my code :

Code:
Dim rs As Recordset
Dim rs1 As Recordset
Dim a As Integer
Set rs = CurrentDb.OpenRecordset("dbo_tbl_edit_money", , dbReadOnly)
Set rs1 = CurrentDb.OpenRecordset("dbo_tbl_debthimself", , dbReadOnly)

While rs1.EOF = False
If rs1!code = c0.Column(1) Then

rs1.Edit
a = rs1!Total - Text217
rs1!Total = a
rs1.Update

Else
End If
rs1.Move 1
Wend

rs.AddNew
rs!name = c0.Column(0)
rs!code = c0.Column(1)
rs!price = Text217
rs!date = Text22
rs.Update


in the same time it doesn't do the calculate and it doesn't have the error , please help me thanks ...... regards
 
Is it this line that is not working?

Code:
a = rs1!Total - Text217

Perhaps try...

Code:
a = rs1!Total - Me.Text217

I would also try adding Me. in front of anything that is suppose to refer to a Control on the Form.
 
thanks @GinaWhipp , i fixed by another way , but i have another question , lets say i have a store table it will be consist (item,price,qty) the values lets say i have (pc,20 qty , 50$), then i sell the item lets say i sell 10 and i haved 10 in the store , then coming new some the same item but by different price , how to calculate this thing ?
 

Users who are viewing this thread

Back
Top Bottom