Here is what I'm trying to do:
Call GoToOtherForm("ScenarioOverviewForm", "ScenarioID", "Location"
Private Sub GoToOtherForm(ByVal SelectedForm As String, ByVal FormID As String, ByVal FormFocus As String)
strScenarioID = Me![OrdnanceID]
DoCmd.Close acForm, "ScenarioOrdnanceForm"
DoCmd.OpenForm SelectedForm, , , , acFormEdit, , strScenario_ID
Forms!ScenarioOverviewForm![FormID].SetFocus
DoCmd.FindRecord strScenarioID, , True, , True, , True
Forms!ScenarioOverviewForm![FormFocus].SetFocus
End Sub
The correct form does open...but it can't find the FormID or FormFocus I pass to the Sub. My limited experience tells me this is because the new form doesn't know about the value of the variables being passed. If this is correct...does this mean I need to do something with a global variable...or put the Sub itself in a global module? If so...how would I do that? If incorrect or unnecessary...how can I make this thing work?
Thanks in advance.
Call GoToOtherForm("ScenarioOverviewForm", "ScenarioID", "Location"
Private Sub GoToOtherForm(ByVal SelectedForm As String, ByVal FormID As String, ByVal FormFocus As String)
strScenarioID = Me![OrdnanceID]
DoCmd.Close acForm, "ScenarioOrdnanceForm"
DoCmd.OpenForm SelectedForm, , , , acFormEdit, , strScenario_ID
Forms!ScenarioOverviewForm![FormID].SetFocus
DoCmd.FindRecord strScenarioID, , True, , True, , True
Forms!ScenarioOverviewForm![FormFocus].SetFocus
End Sub
The correct form does open...but it can't find the FormID or FormFocus I pass to the Sub. My limited experience tells me this is because the new form doesn't know about the value of the variables being passed. If this is correct...does this mean I need to do something with a global variable...or put the Sub itself in a global module? If so...how would I do that? If incorrect or unnecessary...how can I make this thing work?
Thanks in advance.