My users like to see Audit forms,
reflect any changes in the data, right away.
If they're toggling back & forth between an Editable Form,
and an audit form, they're feel their edits are not being saved,
or the Audit form is not Computing correctly,
if the changes are not updateing, instantaneously.
And So, I came up with this,
iterate through all the open forms in the DBase,
iterate through the pertinant controls, of each open form,
and requery each control.
So from each relevant form, that has an audit form,
either in the control afterUpdate event,
or the form afterUpdate event,
I call the "refreshForms" procedure.
Private Sub txtGrandTotal_AfterUpdate()
Me.Refresh
Call RefreshForms
End Sub
_____________________________________________
Private Sub Form_AfterUpdate()
Me.Refresh
Call RefreshForms
End Sub
_________________________________________________
Sub RefreshForms()
10 On Error GoTo xxx
Dim x As Integer
20 For x = 0 To Forms.Count - 1
30 Call RefreshForm(Forms(x))
40 Next
xx:
50 Exit Sub
xxx:
60 MsgBox err & vbcrLf & Error$
70 Resume xx
End Sub
Sub RefreshForm(frmForm As Form)
10 On Error GoTo xxx
Dim x As Integer
20 With frmForm
25 .Recalc
30 For x = 0 To .Controls.Count - 1
40 Select Case .Controls(x).ControlType
Case acComboBox, acListBox, acSubform
50 .Controls(x).Requery
60 End Select
70 Next
80 .Refresh
90 End With
xx:
100 Exit Sub
xxx:
If err.Number = 2478 Then
Resume Next
Else
60 MsgBox err & vbcrLf & Error$
70 Resume xx
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.