Running ControlName_AfterUpdate

jcruzAME

Registered User.
Local time
Today, 12:50
Joined
Oct 5, 2011
Messages
135
Is it possible to have code run the _AfterUpdate event?

I've seen it done with ControlName_Click in the program I'm working on but it dosen't seem to be working if I try to do ControlName_AfterUpdate.
 
Is the call that is not working located on another Form? If so, rather than making the actual event public which Access created for the Click event, I create a second event which itself is Public and is used for other forms to be able to "push the button" and I call that event also from the button click event which, like I said, Access creates as a private event. Sample of what I am talking about:


Code:
[B]Private[/B] Sub btnRefresh_Click()

  Call Refresh_Click

End Sub

'This must be Public
[B]Public[/B] Sub Refresh_Click(Optional ByVal lRecordID As Long)
  On Error GoTo Err_Refresh_Click

  'Worker code goes here...

Exit_Refresh_Click:
  Exit Sub

Err_Refresh_Click:
  Call errorhandler_MsgBox("Form: Form_quotes, Subroutine: Refresh_Click()")
  Resume Exit_Refresh_Click

End Sub
 
Is it possible to have code run the _AfterUpdate event?

I've seen it done with ControlName_Click in the program I'm working on but it dosen't seem to be working if I try to do ControlName_AfterUpdate.

I think the ControlName_AfterUpdate sub has to exist before you can call it. Does the control in question have an AfterUpdate event already?
 
Why are you needing to call the After Update event? Shouldn't it be called only when an update was executed?

Re-think your objective.
 
Why are you needing to call the After Update event? Shouldn't it be called only when an update was executed?

Re-think your objective.

Is it possible that the control value is being modified through VBA instead of the form control, thus the AfterUpdate event is not being fired so he is calling it explicitly?
 
@harmankardon: If that's the case then the update would either be done by calling an Action query, running an UPDATE statement or via a recordset. In any of these cases, the After Update event is irrelevant. If the changes are not being reflected on the form, the form just needs to be requeried.
 
I found the problem. There was faulty logic in the code hat was bypassing the AfterUpdate call. What happens is after switching to another tab on the Navigation controls, if there's a certain condition met, it will run the after update to pull the correct data. The after update is for a combo box that holds a list of clients.
 
So you didn't need to call the After Update event afterall?
 
No I did, there is one form that shows clients and their net worth. When you click on one of them, it switches to the Client tab, grabs their Client ID (which is the bound column in the combo box on the Client Tab) and runs the After Update, as if you just selected them on that page.
 
Alright, you just wanted to re-run the code that's in the After Update event of that control. I thought you had other intentions.
 

Users who are viewing this thread

Back
Top Bottom