I am using the following code to set the recordsource of a form depending on which form is used to open it.
If CurrentProject.AllForms("frmSalesDashboard").IsLoaded = True Then
DoCmd.OpenForm "frmActivitiesEdit", acDesign
Forms!frmActivitiesEdit.RecordSource = qryActivitiesEdit
DoCmd.Close acForm, "frmActivitiesEdit", acSaveYes
'DoCmd.OpenForm "frmActivitiesEdit", acNormal, acSaveYes
DoCmd.OpenForm "frmActivitiesEdit", , , "ActionID = " & Me.txtActionID
ElseIf CurrentProject.AllForms("frmActivitiesOverview").IsLoaded = True Then
DoCmd.OpenForm "frmActivitiesEdit", acDesign
Forms!frmActivitiesEdit.RecordSource = qryActivitiesEdit
DoCmd.Close acForm, "frmActivitiesEdit", acSaveYes
'DoCmd.OpenForm "frmActivitiesEdit", acNormal, acSaveYes
DoCmd.OpenForm "frmActivitiesEdit", , , "ActionID = " & Me.txtActionID
End If
Form SalesDashBoard is always open so the code always goes to that section of the code not to the overview section when required
Question: How do I get around this????
Thanks in advance
Bob
If CurrentProject.AllForms("frmSalesDashboard").IsLoaded = True Then
DoCmd.OpenForm "frmActivitiesEdit", acDesign
Forms!frmActivitiesEdit.RecordSource = qryActivitiesEdit
DoCmd.Close acForm, "frmActivitiesEdit", acSaveYes
'DoCmd.OpenForm "frmActivitiesEdit", acNormal, acSaveYes
DoCmd.OpenForm "frmActivitiesEdit", , , "ActionID = " & Me.txtActionID
ElseIf CurrentProject.AllForms("frmActivitiesOverview").IsLoaded = True Then
DoCmd.OpenForm "frmActivitiesEdit", acDesign
Forms!frmActivitiesEdit.RecordSource = qryActivitiesEdit
DoCmd.Close acForm, "frmActivitiesEdit", acSaveYes
'DoCmd.OpenForm "frmActivitiesEdit", acNormal, acSaveYes
DoCmd.OpenForm "frmActivitiesEdit", , , "ActionID = " & Me.txtActionID
End If
Form SalesDashBoard is always open so the code always goes to that section of the code not to the overview section when required
Question: How do I get around this????
Thanks in advance
Bob