Hi,
I have a main form with a combo box (cboTempSelect)and command button(cmdSelectTemplate) .
When the user selects a text in the combo box (cboTempSelect), the user then clicks the command button (cmdSelectTemplate)which fills in data in 4 subforms of this main form.
Private Sub cmdSelectTemplate_Click()
On Error GoTo Err_cmdSelectTemplate_Click
DoCmd.SetWarnings False
DoCmd.OpenQuery "appCarePlanProblem", acNormal, acEdit
DoCmd.OpenQuery "appCarePlanOutcome", acNormal, acEdit
DoCmd.OpenQuery "appCarePlanEquipment", acNormal, acEdit
DoCmd.OpenQuery "appCarePlanInterventions", acNormal, acEdit
DoCmd.SetWarnings True
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
Exit_cmdSelectTemplate_Click:
Exit Sub
Err_cmdSelectTemplate_Click:
MsgBox Err.Description
Resume Exit_cmdSelectTemplate_Click:
End Sub
The problem with this method is the user has to click the command button (cmdSelectTemplate) TWICE to run the above code and for the subforms to refresh with the data.
Is there anyway I can code this so the user only has to click the command button once, codes runs and subforms fill in with appropiate information?
Any assistance would be greatly appreciated.
I have a main form with a combo box (cboTempSelect)and command button(cmdSelectTemplate) .
When the user selects a text in the combo box (cboTempSelect), the user then clicks the command button (cmdSelectTemplate)which fills in data in 4 subforms of this main form.
Private Sub cmdSelectTemplate_Click()
On Error GoTo Err_cmdSelectTemplate_Click
DoCmd.SetWarnings False
DoCmd.OpenQuery "appCarePlanProblem", acNormal, acEdit
DoCmd.OpenQuery "appCarePlanOutcome", acNormal, acEdit
DoCmd.OpenQuery "appCarePlanEquipment", acNormal, acEdit
DoCmd.OpenQuery "appCarePlanInterventions", acNormal, acEdit
DoCmd.SetWarnings True
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
Exit_cmdSelectTemplate_Click:
Exit Sub
Err_cmdSelectTemplate_Click:
MsgBox Err.Description
Resume Exit_cmdSelectTemplate_Click:
End Sub
The problem with this method is the user has to click the command button (cmdSelectTemplate) TWICE to run the above code and for the subforms to refresh with the data.
Is there anyway I can code this so the user only has to click the command button once, codes runs and subforms fill in with appropiate information?
Any assistance would be greatly appreciated.