Refresh Form from a function

  • Thread starter Thread starter Alex
  • Start date Start date
A

Alex

I am trying to refresh/repaint a form from a public function. The form
refreshes with no problem when using an on event on the form but it does not
otherwise.
 
Easy way, from anywhere assuming the function is being called from the form
you are using:

Screen.ActiveForm.Repaint
 
The function is being called from the form but Screen.ActiveForm.Repaint is
not working. The control I'm trying to refresh is a list box could that be
the issue? It refreshes fine using an event on the form.
 
You should have said that in the first place.
If it is the active control, then
Screen.ActiveControl.Repaint
 
That did't do it, the function will be called ervery 5 inutes using the On
Timer event of the form. The function should update the contents of the list
box as it runs. The contents of the list box is popolated by a SQL server
using an ADODB connection.
 
Okay, pass the name of the form and control to the function:

x = MyFunction("MyFormName","MyControlName")

Public Function MyFunction(strFrm as String, strCtl as String)

Forms(strFrm).Controls(strCtl).ReQuery

End Function

Note the Repaint and Refresh methods apply only to form objects. For a list
box, use the Requery method.
 
Back
Top