Recalc Syntax

  • Thread starter Thread starter DS
  • Start date Start date
D

DS

I'm using this code on a delete key, the key is on a subform. There is
an unbound field [txtSubTotal] on the main form whenever I delete a
record in the Subform the [txtSubTotal] field is not updating.
Is the Syntax wrong?
Thank You
DS

Private Sub cmdDelete_Click()
On Error GoTo GotError
DoCmd.SetWarnings False 'turn system messages off
DoCmd.RunCommand acCmdDeleteRecord
Me.Parent!txtSubTotal.Recalc
DoCmd.SetWarnings True 'turn system messages on
ExitSub:
Exit Sub


GotError:
Select Case Err.Number
Case 3021
Resume ExitSub
Case 2465
Resume ExitSub
Case 3075
Resume ExitSub
Case Else
'MsgBox Err.Number & vbCrLf & Err.Description & vbCrLf & "Order
Details cmdDelete_Click"
Resume ExitSub
End Select
End Sub
 
DS said:
I'm using this code on a delete key, the key is on a subform. There is
an unbound field [txtSubTotal] on the main form whenever I delete a
record in the Subform the [txtSubTotal] field is not updating.
Is the Syntax wrong?
Thank You
DS

Private Sub cmdDelete_Click()
On Error GoTo GotError
DoCmd.SetWarnings False 'turn system messages off
DoCmd.RunCommand acCmdDeleteRecord
Me.Parent!txtSubTotal.Recalc
DoCmd.SetWarnings True 'turn system messages on
ExitSub:
Exit Sub


GotError:
Select Case Err.Number
Case 3021
Resume ExitSub
Case 2465
Resume ExitSub
Case 3075
Resume ExitSub
Case Else
'MsgBox Err.Number & vbCrLf & Err.Description & vbCrLf & "Order
Details cmdDelete_Click"
Resume ExitSub
End Select
End Sub

The Recalc method applies to the form as a whole, not an individual text box
i.e. Me.Parent.Recalc
 
.... and if you want to recalc an unbound / calculated TextBox Control, you
can use ReQuery to recalc the value.
 
Back
Top