Results 1 to 8 of 8
  1. #1
    michaelb is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2011
    Posts
    28

    Wink Running an Update Query from a Macro

    Hello All,
    I would like to run an Update Query from a Macro. I want to run the Macro using the ON LOAD Event of a report. I look at all of the Actions within the Macro Builder but did not find a way to do it. Please Help...

  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
    I don't use macros, but I think you want OpenQuery. If it's not visible, you may need to click on Show All Actions on the ribbon.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    michaelb is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2011
    Posts
    28

    Running UpdateQuery

    I saw the OpenQuery Action. I did not see an option for it to automatically run. I don't have to use a Macro. If you know how to run the Update Query using a Macro or using VBA, please let me know.

  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
    In VBA it would be CurrentDb.Execute or DoCmd.OpenQuery. To get your macro to run automatically, you would call it from the on load event. Same with code.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    michaelb is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2011
    Posts
    28
    Thank you pbaldy. I will try what you suggested...

    Michael...

  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
    No problem, let me know how it goes.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    michaelb is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2011
    Posts
    28
    pbaldy,
    I used the following command with the OnOpen Event for a report and it worked like a charm.

    DoCmd.Openquery "UpdateQuery"

    Thanks again...

  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
    Glad it worked for you.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 13
    Last Post: 02-23-2011, 08:38 AM
  2. Running an update query
    By markod in forum Queries
    Replies: 3
    Last Post: 11-11-2010, 01:24 PM
  3. Running update query in access 2010
    By dbansal in forum Queries
    Replies: 1
    Last Post: 09-03-2010, 10:57 AM
  4. Help Automatically running and Update Query
    By JohnRandolphSTL in forum Queries
    Replies: 8
    Last Post: 04-13-2010, 02:08 PM
  5. Replies: 2
    Last Post: 09-30-2009, 09:40 AM

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