Results 1 to 14 of 14
  1. #1
    rebfein's Avatar
    rebfein is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2015
    Location
    So Cal
    Posts
    114

    Can I create a button to run a series of queries? No pun intended :)

    For all of you who have supplied answers to my posts, I send out my heartfelt gratitude for all the help I've received on this project. Bless you all. Now one more issue...




    I've created a home page where I've put all the forms and reports that I've created for this database for those who are going to use it (everything in one place). I'm attaching a screen shot of the form view. I would like to add a Nav button to the first row that says "Queries," then list the four queries in the secondary Nav bar.

    Click image for larger version. 

Name:	Form & Report.png 
Views:	16 
Size:	52.6 KB 
ID:	20124

    My boss liked it, and I'm wondering if:

    1. Could I, and how would I, create a 'Run' button that would run each of the queries (when they update the database [a few times a year}) to update/refresh them?

    In the home stretch and again a big Thank you everyone,

    Rebecca

  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,632
    What are these queries to be run - UPDATE, INSERT, DELETE?

    Code can run query objects or SQL statements.
    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
    rebfein's Avatar
    rebfein is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2015
    Location
    So Cal
    Posts
    114
    One is a delete query, another is an append query, and two are really sorting queries.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    "Sorting" queries do not have to be 'run'.
    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.

  5. #5
    rebfein's Avatar
    rebfein is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2015
    Location
    So Cal
    Posts
    114
    Ok, what about the other two?

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    I use only VBA, no macros. I prefer CurrentDb.Execute method.

    CurrentDb.Execute "SQL statement here"

    Example:

    CurrentDb.Execute "DELETE FROM tablename WHERE some criteria here"
    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.

  7. #7
    rebfein's Avatar
    rebfein is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2015
    Location
    So Cal
    Posts
    114
    June7,Thank you for your response, but that is a bit too much programming for me at the moment. Since I'm a newbie with Access, I don't want to inadvertently create something that may explode as I did in 7th grade chem class.Rebecca

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    Alternatively, can set up saved query objects and run them from code - VBA or macro.
    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.

  9. #9
    rebfein's Avatar
    rebfein is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2015
    Location
    So Cal
    Posts
    114
    Please tell me how to do that. :|

  10. #10
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    Use the query designer to build query object.

    In VBA the code would be:

    DoCmd.OpenQuery "query name here"

    There is macro equivalent but I don't use macros.
    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.

  11. #11
    rebfein's Avatar
    rebfein is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2015
    Location
    So Cal
    Posts
    114
    I'll try it.

    Thank you,

    Rebecca

  12. #12
    rebfein's Avatar
    rebfein is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2015
    Location
    So Cal
    Posts
    114
    June7,

    Sorry for the delay in getting back to you; got involved in another short project.

    I tried your suggestion and it didn't work. What's next?

  13. #13
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    What does "didn't work" mean - error message, wrong results, nothing happens? What exactly did you do? Need something to analyse - provide code or database.
    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.

  14. #14
    rebfein's Avatar
    rebfein is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2015
    Location
    So Cal
    Posts
    114
    I would love to provide an answer, but I'm involved in another part of the project at the moment. I'll try to get back to it early next week and get you more information.

    Thank you,

    Rebecca

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

Similar Threads

  1. Replies: 3
    Last Post: 05-22-2014, 09:23 AM
  2. Newbie to Access. Help with a series of queries.
    By mdmcguire in forum Queries
    Replies: 5
    Last Post: 10-17-2013, 12:14 PM
  3. Replies: 12
    Last Post: 07-13-2012, 02:00 PM
  4. form not displaying as intended
    By markjkubicki in forum Forms
    Replies: 1
    Last Post: 07-24-2010, 07:04 AM
  5. Replies: 0
    Last Post: 07-22-2010, 07:43 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