Results 1 to 9 of 9
  1. #1
    Join Date
    Apr 2010
    Posts
    5

    Help Automatically running and Update Query


    I have an excel spreadsheet that I have as a linked table within Access. That excel spreadsheet updates on a daily basis. I have another table within access that is pulling information out of the linked excel table. I have a query set up that will update the information in the existing table from the linked excel table.

    Is there any way I can have this query automatically run every night? Or is there a way that I can have the query automatically update when I open the program?

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    You can do either. If you have multiple users, I'd go with the first (otherwise every user is running the update). I'd create an MDB/ACCDB that did your update when it started, then closes itself. Then I'd run that file from Windows Scheduled Tasks.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Join Date
    Apr 2010
    Posts
    5
    How would I tell the Scheduled Task to run it though?

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Not sure what you mean. You'd specify your MDB in the Run box in Scheduled Tasks. In your MDB, you can use an AutoExec macro to kick off your process.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    Join Date
    Apr 2010
    Posts
    5
    That's where my problem is...I don't know how to set up an AutoExec macro. Do you know code for that by chance? Or the steps I would need to take in Access to create one.

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    You simply create a macro that does what you want, either within itself or by calling a VBA function that does what you want, and name it "autoexec". Any macro with that name is automatically run on startup.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    Join Date
    Apr 2010
    Posts
    5
    Awesome! Thank you! But now I get the message: 'You won't be able to undo the changes this action query is about to make to the data in a linked table or tables' every time the schedule task runs. Where would I remark out that I am ok with this? Here is my code so far.

    UPDATE q_VoltageForDay INNER JOIN ServicePoint ON q_VoltageForDay.BI_SRV_MAP_LOC = ServicePoint.MAP_NO SET ServicePoint.Voltage_Min = [q_VoltageForDay].[Min], ServicePoint.Voltage_Average = [q_VoltageForDay].[Average], ServicePoint.Voltage_Max = [q_VoltageForDay].[Max];

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    You're just executing the query from the macro? You can either:

    Put a SetWarnings action before executing, setting them to False. Then after executing the query set them back to True.

    In 2007 click on the Office Button then Access Options. On the Advanced tab uncheck the box under Confirm for Action Queries.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  9. #9
    Join Date
    Apr 2010
    Posts
    5
    I have all of those boxes unchecked. When I have that option checked it gives me three dialog boxes. Right now all three of those boxes are unchecked, 'Record Changes' 'Document deletions' and 'Action queries' but I am still receiving that last message. I don't know how to set a warning within that sql table. I'm fairly new to access. How would the code look with my SQL statement?

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Query with a running sum
    By is49460 in forum Queries
    Replies: 3
    Last Post: 09-07-2013, 11:11 PM
  2. running a function after update
    By jamin14 in forum Programming
    Replies: 9
    Last Post: 04-06-2010, 09:40 AM
  3. I want to automatically pass a value to a query
    By Slategrey252 in forum Queries
    Replies: 1
    Last Post: 10-01-2009, 05:38 AM
  4. Replies: 0
    Last Post: 06-21-2009, 01:29 PM
  5. Replies: 4
    Last Post: 05-19-2009, 04:15 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums