Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Live Update Forms

Status
Not open for further replies.

Tommy408

Programmer
Apr 30, 2006
53
US
Changing focus or manually refresh a form will update the data displaying on a form. How can I have it auto-update when the database is change like a chat room?
Thank you.
 
You did not give much details, but maybe have to use the forms timer event.
 
Depending on the form that's being updated,
I run the following code, after either the form_Update,
or Control_Update event.

Private Sub txtGrandTotal_AfterUpdate()
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 Call ErrorLog(err, Error$, err.Source, "Sub: RefreshForms", Erl)
70 Resume xx
End Sub

________________________________________________________

Sub RefreshForm(frmForm As Form)
10 On Error GoTo xxx

Dim x As Integer
20 With frmForm
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:
110 If err.Number = 2478 Then
120 Resume Next
130 Else
140 Call ErrorLog(err, Error$, err.Source, "Sub: RefreshForm", Erl)
150 Resume xx
160 End If
End Sub

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top