Change table field value

Kinger43

racecar driver
Local time
Today, 02:27
Joined
Aug 17, 2007
Messages
226
I want to make a button that will find a particular record and change the value of the field. I was hoping that there was some way to do this through a macro rather than making a new query. With the SetValue action you can do this with a form etc. but it will not allow me to do this for a table. Is there some equivalent action or some way around this?
 
You can build a sql statement and execute it...
 
Calculated Field Updating Table

'PERHAPS WITH THIS YOU HAVE AN IDEA FOR UPDATING THE TABLE WITH A CALCULATED FIELD
‘CALCUTATED FIELD AND UPDATE THE TABLE
‘CODE IN SUBFORM OR IN A FORM, GO TO PROPERTIES, EVENT PROCEDURE
‘EVENT AfterUpdate


Option Compare Database
Dim A As Double
Private Sub PRICE_AfterUpdate()
Dim A, B, C As Double
If IsNull([QUANTITY])
A = 0
Else
A = [QUANTITY]
End If
If IsNull([PRICE]) Then
B = 0
Else
B = [PRICE]
End If
C = A *B
´ROUND THE TOTAL PRICE 2 DECIMALS
Me![TOTALPRICE] = Int(C *100 + 0.5) / 100
End Sub

Private Sub QUANTITY _AfterUpdate()
Dim A, B, C, D As Double
Dim A, B, C As Double
If IsNull([QUANTITY]) Then
A = 0
Else
A = [QUANTITY]
End If
If IsNull([PRICE]) Then
B = 0
Else
B = [PRICE]
End If
C = A *B
Me![TOTALPRICE] = Int(C *100 + 0.5) / 100

End Sub
 
The SQL statement worked fine. Simple UPDATE SQL. I appreciate the code, but that was way more complicated than what I was looking for. It is just a text field that either has "Open" in it. For some records I just need to change this to "Hold".
 

Users who are viewing this thread

Back
Top Bottom