FrymanTCU
12-17-2007, 09:44 AM
I have built a tool that users enter their time to on a daily basis through some very simple VB scripting and a backend mdb with a switchboard for managers to pull reports. The management reports run off make table queries and such that their are multiple confimation boxes that pop up and users click to proceed. But my macro has a delete table then it runs the queries I need to populate the reports. I have not seen a built in macro to disable this on other user machines? Or how could someone help with the macro to run the delete queries only if if the tables exist? Thanks in advance for the help. I have pasted the code for the AutoExc Macro below, Please let me know if you need any additional information.
Option Compare Database
Option Explicit
'------------------------------------------------------------
' AutoExec_CurPayPerRefresh
'
'------------------------------------------------------------
Function AutoExec_CurPayPerRefresh()
On Error GoTo AutoExec_CurPayPerRefresh_Err
DoCmd.DeleteObject acTable, "1a - Entry Table with Missing Days"
DoCmd.DeleteObject acTable, "1b - Pull last Data from Entry Table 1a"
DoCmd.DeleteObject acTable, "1c - TimeSerialValue from Last of EntryTable"
DoCmd.DeleteObject acTable, "2 - Valid Entries with Entered Time"
DoCmd.OpenQuery "1a - Add Missing Dates to EntryTable", acViewNormal, acReadOnly
DoCmd.OpenQuery "1b - Pull Last Data from Entry Table", acViewNormal, acReadOnly
DoCmd.OpenQuery "1c - Last of Entry TimeSerialValue", acViewNormal, acReadOnly
DoCmd.OpenQuery "2-Make Final Timekeeping Table", acViewNormal, acReadOnly
DoCmd.OpenForm "Switchboard", acNormal, "", "", , acNormal
DoCmd.Maximize
AutoExec_CurPayPerRefresh_Exit:
Exit Function
AutoExec_CurPayPerRefresh_Err:
MsgBox Error$
Resume AutoExec_CurPayPerRefresh_Exit
End Function
Option Compare Database
Option Explicit
'------------------------------------------------------------
' AutoExec_CurPayPerRefresh
'
'------------------------------------------------------------
Function AutoExec_CurPayPerRefresh()
On Error GoTo AutoExec_CurPayPerRefresh_Err
DoCmd.DeleteObject acTable, "1a - Entry Table with Missing Days"
DoCmd.DeleteObject acTable, "1b - Pull last Data from Entry Table 1a"
DoCmd.DeleteObject acTable, "1c - TimeSerialValue from Last of EntryTable"
DoCmd.DeleteObject acTable, "2 - Valid Entries with Entered Time"
DoCmd.OpenQuery "1a - Add Missing Dates to EntryTable", acViewNormal, acReadOnly
DoCmd.OpenQuery "1b - Pull Last Data from Entry Table", acViewNormal, acReadOnly
DoCmd.OpenQuery "1c - Last of Entry TimeSerialValue", acViewNormal, acReadOnly
DoCmd.OpenQuery "2-Make Final Timekeeping Table", acViewNormal, acReadOnly
DoCmd.OpenForm "Switchboard", acNormal, "", "", , acNormal
DoCmd.Maximize
AutoExec_CurPayPerRefresh_Exit:
Exit Function
AutoExec_CurPayPerRefresh_Err:
MsgBox Error$
Resume AutoExec_CurPayPerRefresh_Exit
End Function