I have 3 forms that pull data table from the same table based on criteria in the query. FormA for System A, FormB for System B and FormA for System A. Only one of these forms are open at any given time.Each of these forms has an add record command button and I am using the same for form, AddRecord. There are 3 command buttons set to add a record record for each system.
After the data entry is complete I need to requery the for is is open.
Example: I have FormB open and add a record. When I hit the save I need it to requery FormB. Using If and Elseif can I determine which form is open?
Private Sub cmdSave_Click()
If Me.Dirty Then
DoCmd.RunCommand acCmdRefresh
Else
End If
If <FormA> is open Then
MsgBox "The station has been added.", vbOKOnly, "Save Station"
Forms!frm_FormA.Requery
Elseif <FormB> is open Then
MsgBox "The station has been added.", vbOKOnly, "Save Station"
Forms!frm_FormB.Requery
Elseif <FormC> is open Then
MsgBox "The station has been added.", vbOKOnly, "Save Station"
Forms!frm_FormC.Requery
End IF
End Sub
I hope I am clear in what I am asking. Any assistance would be greatly appreciated.