reischaa
11-27-2000, 03:25 PM
I am trying to write code that will update the dropdown list for combo boxes on two other forms (Barrier Data Form, and Dam Data Form) and a subform to the Barrier Data Form (DamPurposeSubform) when the information in the Reference Form has been updated. I am going about this by trial and error. The problem I am having is that I think the forms and subforms to update have to be open in order for this to work. What I want to do is write some sort of if...then statement that would only try to update the combobox if the respective form is open. Something along the lines of, 'if Dam Data Form is open update the combobox, then check to see if Barrier Data Form is open, and if so update it as well...' in effect updating only the combo boxes on the open forms. What is the syntax for the 'if' statement to determine if a form is open?. The code I have so far is as follows...(which seems to work as long as all the forms mentioned are open). This code is attached to the Reference form. Thanks for any suggestions.
Private Sub Form_AfterUpdate()
RequeryList_Form_AfterUpdate
RequeryListDam_Form_AfterUpdate
RequeryListDamPurposeSF_Form_AfterUpdate
End Sub
Sub RequeryList_Form_AfterUpdate()
Dim ctlList As Control
Set ctlList = Forms![Barrier Data Form]![RefID]
ctlList.Requery
End Sub
Sub RequeryListDam_Form_AfterUpdate()
Dim ctlListD As Control
Set ctlListD = Forms![Dam Data Form]![RefID]
ctlListD.Requery
End Sub
Sub RequeryListDamPurposeSF_Form_AfterUpdate()
Dim ctlListP As Control
Set ctlListP = Forms![Dam Data Form]![DamPurposeSubform child].Form![DamxDamPurpose.RefID]
ctlListP.Requery
End Sub
Private Sub Form_AfterUpdate()
RequeryList_Form_AfterUpdate
RequeryListDam_Form_AfterUpdate
RequeryListDamPurposeSF_Form_AfterUpdate
End Sub
Sub RequeryList_Form_AfterUpdate()
Dim ctlList As Control
Set ctlList = Forms![Barrier Data Form]![RefID]
ctlList.Requery
End Sub
Sub RequeryListDam_Form_AfterUpdate()
Dim ctlListD As Control
Set ctlListD = Forms![Dam Data Form]![RefID]
ctlListD.Requery
End Sub
Sub RequeryListDamPurposeSF_Form_AfterUpdate()
Dim ctlListP As Control
Set ctlListP = Forms![Dam Data Form]![DamPurposeSubform child].Form![DamxDamPurpose.RefID]
ctlListP.Requery
End Sub