In VBA, I’m changing the value of a few controls in an Access form. I like to run the BeforeUpdate events of these controls after doing so, as it checks the coherence between fields :
Private Sub ExampleProc1()
Dim intCancel as Integer
intCancel = False
Me.Controls("Date1").Value=Null
Me.Controls("Textfield1").Value=Null
Call Date1_BeforeUpdate(intCancel)
Call Textfield1_BeforeUpdate(intCancel)
End Sub
I’d like to make it generic, but I can’t find a way to run the event procedure. I’d like something like that :
Private Sub ExampleProc2(ParamArray Fields())
Dim intCancel as Integer, varV as Variant
For Each varV in Fields
Me.Controls(varV).value=Null
intCancel = False
Call Me.Controls(varV).BeforeUpdate(intCancel)
Next
End Sub
Is this even possible? Maybe something with DoCmd.RunMacro is the way to go?
Actually you can do it using CallByName