Refresh Form value based on update Query (1 Viewer)

tucker61

Registered User.
Local time
Yesterday, 19:29
Joined
Jan 13, 2008
Messages
344
I have a vba update query that sets the Claim Value - which works.

Code:
DoCmd.RunSQL "UPDATE QryqcCharges SET Claim_Value = " & ClaimValue & " WHERE Job_ID=" & Nz(Forms!FrmCharges.Job_ID, 0) & " AND [Quote/Charge]=" & CurformType & ";"

the value on my form does not refresh until i go out of the form and come back in . Even though i have the requery code in the after update field of a textbox.

How do i make sure this total is updated when the values are updated ?

Code:
Private Sub tbQty_AfterUpdate()
    ' Update Claim Value
    UpdateClaimValue 1
    ' Requery total and update claim value
    Forms!FrmCharges!tbTotalCharge.Requery
End Sub
 
is your form a single Form?
try:
Code:
Private Sub tbQty_AfterUpdate()
   Dim jobID As Long
   jobID = Me.Job_ID
    ' Update Claim Value
    UpdateClaimValue 1
    ' Requery total and update claim value
    With Forms!FrmCharges
           .Requery
           .Recordset.FindFirst "Job_ID = " & jobID
     End With
End Sub

or you can try:

Forms!FrmCharges.Recordset.Requery
 
I would always go with the latter, since I found out about it. :)
 
is your form a single Form?
try:
Code:
Private Sub tbQty_AfterUpdate()
   Dim jobID As Long
   jobID = Me.Job_ID
    ' Update Claim Value
    UpdateClaimValue 1
    ' Requery total and update claim value
    With Forms!FrmCharges
           .Requery
           .Recordset.FindFirst "Job_ID = " & jobID
     End With
End Sub

or you can try:

Forms!FrmCharges.Recordset.Requery
Thanks it is a single form, Forms!FrmCharges.Recordset.requery does work - because this is in a Afterupdate event - it is not including the current line in the total, So thinking i need to move it from this event to a different one.
 
use AfterUpdate Event of the form.
 

Users who are viewing this thread

Back
Top Bottom