Please help; I have a module that imports data from an Excel speadsheet into a staging table. Then it runs various queries to append the data to the appropriate tables within the db. Previously it was an annual process, and it was easiest to simply modify the query defs once a year to identify the reporting period. Now, it is being done quarterly, so I have created a modal form to allow the user to select the quarter from the drop-down list. The code in my module is as follows:
' Begin import process
DoCmd.OpenForm "frm_quarter_for_import", acNormal
DoCmd.GoToControl "Quarter"
' START IMPORTING ANALYZER TEMPLATE
DoCmd.SetWarnings False
' Import the current template into the "tblDetailImportStage" table. (Range: B10:K20)
DoCmd.TransferSpreadsheet acImport, 8, "tblDetailImportStage", "Quarterly Update Facilities Consolidated.xls", False, "Facility001!B10:K20"
' UPDATE ALL ASSOCIATED DATA TABLES WITH THE CURRENT DATA
' Update the "tblDetail" Phase 1
DoCmd.SetWarnings False
DoCmd.OpenQuery "qryLoadDetail", acViewNormal, acEdit
DoCmd.Close acQuery, "qryLoadDetail"
My problem is how do I stop the code until the form has opened and the user has selected the appropriate value and clicked the "OK" button on the form to set the control value? The query def "qryLoadDetail" uses the value from the form's "Quarter" control to populate the records with the proper Quarter ID.
Please help.
' Begin import process
DoCmd.OpenForm "frm_quarter_for_import", acNormal
DoCmd.GoToControl "Quarter"
' START IMPORTING ANALYZER TEMPLATE
DoCmd.SetWarnings False
' Import the current template into the "tblDetailImportStage" table. (Range: B10:K20)
DoCmd.TransferSpreadsheet acImport, 8, "tblDetailImportStage", "Quarterly Update Facilities Consolidated.xls", False, "Facility001!B10:K20"
' UPDATE ALL ASSOCIATED DATA TABLES WITH THE CURRENT DATA
' Update the "tblDetail" Phase 1
DoCmd.SetWarnings False
DoCmd.OpenQuery "qryLoadDetail", acViewNormal, acEdit
DoCmd.Close acQuery, "qryLoadDetail"
My problem is how do I stop the code until the form has opened and the user has selected the appropriate value and clicked the "OK" button on the form to set the control value? The query def "qryLoadDetail" uses the value from the form's "Quarter" control to populate the records with the proper Quarter ID.
Please help.