I have a module tied to a control in a form. This module refreshes the form.
There seems to be a lag in how quickly it refreshes.
Sometimes, you have to click around in the form to get it to refresh, or manually hit shift+F9 to get the form to refresh.
I have a query that updates a table if the value in this form is changed. It's called from the Afterupdate property of the control, then on Exit, I call the module.
The change is happening in a form, (Table 1) and updating fields in a subform (Table 2) based on the changes made.
Thank you!
Any thoughts on improving this?
Option Explicit
Public Sub RefreshForms()
On Error GoTo ERR_HANDLER
Dim i As Integer
For i = 0 To Forms.Count - 1
Call RefreshForm(Forms(i))
Next
EXIT_PROC:
Exit Sub
ERR_HANDLER:
MsgBox Err & vbCrLf & Error$
Resume EXIT_PROC:
End Sub
Private Sub RefreshForm(frmForm As Form)
On Error GoTo ERR_HANDLER
Dim i As Integer
With frmForm
.Recalc
For i = 0 To .Controls.Count - 1
Select Case .Controls(i).ControlType
Case acComboBox, acListBox, acSubform
.Controls(i).Requery
End Select
Next
.Refresh
End With
EXIT_PROC:
Exit Sub
ERR_HANDLER:
If Err.Number = 2478 Then
Resume Next
Else
MsgBox Err & vbCrLf & Error$
Resume EXIT_PROC
End If
End Sub