INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Functions

How to Refresh All open Forms when necessary by Zion7
Posted: 1 May 06 (Edited 10 Jun 06)

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

       End If
End Sub


Back to Microsoft: Access Modules (VBA Coding) FAQ Index
Back to Microsoft: Access Modules (VBA Coding) Forum

My Archive

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close