Excel 2010-Now
Excel 2007
Excel 2003
Tips & Tricks
Excel Forum
Course Index CIG Excel Book
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Visitor Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Excel Export
Ken Davis 

2 years ago
I built a database used to compile data for a report.  This database is strictly for assembling the data into a report.  This data comes from our hospital information system as an excel file.  I have the table linked to the database and so far, everything works.  I want to now be able to export the data to an excel document to send to my boss as an excel document.  The code I am using is below: (Thank you for the tech help video).

On Error GoTo Err    
        DoCmd.OutputTo acOutputQuery, "ProductsReceivedQry", acFormatXLSX, "C:\Users\StopGap Database\Products Received Excel Export.xlsx", True
    DoExit:
        Exit Sub
Err:
        MsgBox "Error outputting. Excel may be open.  Close it first."
        Resume DoExit


I created a table that contains the URL and a from to show the URL where the file can be saved.  What I want to do is instead of hardwiring the file location, I want to be able to change the location if I move the database over to another computer without having to into the programing to do it.  
Once built this database will be given to other locations to use to pull the same reports and collect the same data.  The user would designate the location to save the file and not require them to go into the programming to make the changes.
I have reviewed as many tech help videos I can get my hand on but cannot seem to find the exact answer.
Joe Holland  @Reply  
      
2 years ago
Put the file location in a table/form field. That way each user can adjust the file location based on what they type in the table/form field. Type it in once and you're done. You will then use what is in the form field as a variable in your VBA in place of "C:\Users\StopGap Database\"

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Visitor Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/8/2026 7:52:51 PM. PLT: 1s