Hi,
I have an access 2003 app with many forms displaying data in listboxes.
There are several places where saving a record in one form needs to refresh the lists in other open forms.
I currently do this by calling a public sub which takes the form and listbox name then calls the listbox's requery method. here is the code...
This works fine but means that when I add a new form with a list that may need updating, I have to go back to each form that potentially changes the data being displayed and add another call my requeryControl() sub
If I created an application level event that was fired when the save button is clicked in each data entry form and is listened for in each form displaying related data it would save a lot of time adding new calls to my requeryControl().
I have not looked into creating custom events and am not even sure if what I describe is possible in Access VBA.
Has anyone done something similar or maybe has a different solution with the same outcome?
Many thanks.
Neil.
I have an access 2003 app with many forms displaying data in listboxes.
There are several places where saving a record in one form needs to refresh the lists in other open forms.
I currently do this by calling a public sub which takes the form and listbox name then calls the listbox's requery method. here is the code...
Code:
Public Sub requeryControl(ByVal formName As String, ByVal ctrlName As String)
[green]' used to requery list boxes in related forms when data is changed[/green]
If IsLoaded(formName) Then
Forms(formName).Controls(ctrlName).Requery
End If
End Sub
This works fine but means that when I add a new form with a list that may need updating, I have to go back to each form that potentially changes the data being displayed and add another call my requeryControl() sub
If I created an application level event that was fired when the save button is clicked in each data entry form and is listened for in each form displaying related data it would save a lot of time adding new calls to my requeryControl().
I have not looked into creating custom events and am not even sure if what I describe is possible in Access VBA.
Has anyone done something similar or maybe has a different solution with the same outcome?
Many thanks.
Neil.