A
Alex Martinez
Hi,
I am using Access 2002 and I have a command button that will delete data
from a table which will import an Excel file and append the file into the
main table and a message box (macro) will appear stating that "Upload
Completed" if the user proceed. Below is my coding:
'Delete data in AuditUpload file
CurrentDb.Execute "DELETE * FROM AuditUpload", dbFailOnError
'Upload AuditUpload spreasheet from Excel spreadsheet
On Error GoTo Err_cmdUploadAppend_Click
Dim stDocName As String
stDocName = "Audit Upload"
DoCmd.RunMacro stDocName
'Append AuditUpload to main audit inventory file
Dim stDocName1 As String
stDocName1 = "Append Audit Inventory Query"
DoCmd.OpenQuery stDocName1, acNormal, acEdit
'Notify user upload has completed
Dim stDocName2 As String
stDocName2 = "Upload Completed Message Box"
DoCmd.RunMacro stDocName2
Exit_cmdUploadAppend_Click:
Exit Sub
Err_cmdUploadAppend_Click:
MsgBox Err.Description
Resume Exit_cmdUploadAppend_Click
My question is if a user press the command button and decide to not append
the file where do I place run macro command in the current code? All I want
is to have a message box (macro) to appear saying "Upload/Append not
completed" when the user aborts the append command. If my code needs
cleaning up, please let me know. I am trying to understand message box
errors. Any tips will be appreciated. Thank you.
I am using Access 2002 and I have a command button that will delete data
from a table which will import an Excel file and append the file into the
main table and a message box (macro) will appear stating that "Upload
Completed" if the user proceed. Below is my coding:
'Delete data in AuditUpload file
CurrentDb.Execute "DELETE * FROM AuditUpload", dbFailOnError
'Upload AuditUpload spreasheet from Excel spreadsheet
On Error GoTo Err_cmdUploadAppend_Click
Dim stDocName As String
stDocName = "Audit Upload"
DoCmd.RunMacro stDocName
'Append AuditUpload to main audit inventory file
Dim stDocName1 As String
stDocName1 = "Append Audit Inventory Query"
DoCmd.OpenQuery stDocName1, acNormal, acEdit
'Notify user upload has completed
Dim stDocName2 As String
stDocName2 = "Upload Completed Message Box"
DoCmd.RunMacro stDocName2
Exit_cmdUploadAppend_Click:
Exit Sub
Err_cmdUploadAppend_Click:
MsgBox Err.Description
Resume Exit_cmdUploadAppend_Click
My question is if a user press the command button and decide to not append
the file where do I place run macro command in the current code? All I want
is to have a message box (macro) to appear saying "Upload/Append not
completed" when the user aborts the append command. If my code needs
cleaning up, please let me know. I am trying to understand message box
errors. Any tips will be appreciated. Thank you.