Assuming the table name is "THREE" and you have an ID field set to 1, 2 and 3 for the relevant rows, this should do it:
Sub UpdVals()
'I WANT C3 =B3-C2 BUT WHEN B3 IS GREATER THEN IWANT C 3 =AI -C2 CAN IT
'POSSIBLE
Dim db As Database
Dim rs As Recordset
Dim C3, B3, C2, A1
Set db = CurrentDb
Set rs = db.OpenRecordset("SELECT B FROM THREE WHERE ID=3")
If Not rs.EOF Then
B3 = Nz(rs!B)
Else
GoTo ExitProc
End If
Set rs = db.OpenRecordset("SELECT C FROM THREE WHERE ID=2")
If Not rs.EOF Then
C2 = Nz(rs!C)
Else
GoTo ExitProc
End If
Set rs = db.OpenRecordset("SELECT A FROM THREE WHERE ID=3")
If Not rs.EOF Then
A1 = rs!A & ""
Else
GoTo ExitProc
End If
If B3 <= C2 Then
db.Execute "UPDATE THREE SET C=" & B3 - C2 & " WHERE ID=3"
Else
db.Execute "UPDATE THREE SET C=" & A1 - C2 & " WHERE ID=3"
End If
ExitProc:
End Sub
sirajut wrote:
HELP
24-Nov-09
i have three rows and three col A B
I WANT C3 =B3-C2 BUT WHEN B3 IS GREATER THEN IWANT C 3 =AI -C2 CAN I
POSSIBLE
Previous Posts In This Thread:
EggHeadCafe - Software Developer Portal of Choice
Keep ViewState out of Page for Performance Enhancement Redux
http://www.eggheadcafe.com/tutorial...8-64dd33bfc2fe/keep-viewstate-out-of-pag.aspx