Results 1 to 3 of 3
  1. #1
    hinkwale is offline Novice
    Windows XP Access 2007
    Join Date
    Dec 2014
    Posts
    18

    Automation using a form and vba

    Any ideas on how i can automate the processes via form by have vba execute the queries in sequence and creating output to be exported to excel

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Something like:

    DoCmd.SetWarnings False
    DoCmd.OpenQuery "query1 name"
    DoCmd.OpenQuery "query2 name"
    ...
    DoCmd.SetWarnings True
    'code to export to Excel


    Review http://www.accessmvp.com/KDSnell/EXCEL_MainPage.htm
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    If any of these Queries are dependent on the results of a previous Query, you may need to add a DoEvents command between each one.

    Access is asynchronous, which is to say, if given a series of commands, it starts to execute one, moves on to the next one and starts executing it, and so forth. It doesn't wait for the first command to be completed before starting the second one, and this can cause timing problems.

    DoEvents returns control to Windows, allowing (in the sample below) QueryA to complete running before starting to run QueryB. It then allows QueryB to finish running before starting QueryC, and so forth.

    Code:
    DoCmd.OpenQuery "QueryA"
    DoEvents
    DoCmd.OpenQuery "QueryB"
    DoEvents
    DoCmd.OpenQuery "QueryC"

    Linq ;0)>

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

Similar Threads

  1. Automation
    By hinkwale in forum Access
    Replies: 1
    Last Post: 12-11-2014, 01:55 PM
  2. Automation Error from form
    By gemadan96 in forum Forms
    Replies: 5
    Last Post: 05-21-2014, 12:27 PM
  3. Replies: 4
    Last Post: 02-06-2014, 12:55 AM
  4. Form-Record Automation Problem
    By keatsy_040489 in forum Forms
    Replies: 2
    Last Post: 02-05-2012, 05:08 PM
  5. Data from automation
    By Mstef in forum Import/Export Data
    Replies: 0
    Last Post: 01-05-2009, 10:21 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