Results 1 to 5 of 5
  1. #1
    New Lounger
    Join Date
    Sep 2003
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Automate a macro that has msgboxes (2003)

    Hi,

    I have a macro that runs a delete query and an append query. Each query causes a prompt for the user to OK that the action will be done. If I automate the query using an AutoExec macro or if I use Windows Task Scheduler with something like:

    "C:Program FilesMicrosoft OfficeOffice10MSAccess.exe" "CatabasesMyDatabase.mdb" /x MyMacro

    is there a way (or do I need) to provide a response to the message boxes that pop up? In other words, can I have it run and provide the assumption that the Delete Query and the Append Query should be accepted each time?

    Thanks!

    Stephen

  2. #2
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Automate a macro that has msgboxes (2003)

    Ouch, I have a feeling that a macro will not be enough for this, something, and I am not sure what it is, makes me feel uncomfy with your idea about running update and delete queries without human intervention.

    Just ideas coming off the top of my head as I type.

    1) What happens if there is an error during an append or delete, how is it rectified
    2) Now the database is open, how are you going to close it
    3) If you are about to run an action query on your object, how can you guarantee that nobody is actively using it and has locked a record in that object or recordset.
    4) What happens if the action query does not run, for what ever reson, power cut, fire or flood
    5) With your suggestion, each time the database is opened then the autoexec runs an update/delete, why not just have it as a "open in the morning routine"

    Sorry to sound negative but it just worries me, probablu unnecessarily but it is a nag
    Jerry

  3. #3
    New Lounger
    Join Date
    Sep 2003
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Automate a macro that has msgboxes (2003)

    Thanks for your reply!

    I came across this entry in another post:

    "In a macro, use the SetWarnings action, with argument No before running the append queries, and with argument Yes afterwards.
    In VBA code, use DoCmd.SetWarnings False to turn off the confirmation, and DoCmd.SetWarnings True to turn it on again."

    Is there any reason this wouldn't work or would create problems?

    The database is used for a website and is stored on a server, so the main reason someone should be going to the database directly is to update the tables through this macro.

    Thanks again!

  4. #4
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Automate a macro that has msgboxes (2003)

    No , no reason at all. I feel much happier now that I know it is running on a server for a website. I can't envisage any problems but as you know, test, test and test again. Personally, the latter, VBA code makes me feel better or is that because I have a loathing for over complicated macros <img src=/S/grin.gif border=0 alt=grin width=15 height=15>..go for it
    Jerry

  5. #5
    New Lounger
    Join Date
    Sep 2003
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Automate a macro that has msgboxes (2003)

    Thanks!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •