Computer Learning Zone CLZ Access Excel Word Windows

If I have seen further it is by standing on the shoulders of Giants.

-Isaac Newton
 
Home   Courses   TechHelp   Help   Contact   Merch   Join   Order   Logon   Forums   
 
Back to Microsoft Access 308    Comments List
Upload Images | @Reply | Bookmark | Link | Email | Next Unseen |

Richard Rost 

18 years ago
Shirley, EXCELLENT question.

Yes, it is possible to have the user specify the filename for the export. There are two EASY ways to do it. The first is to simply place a textbox on the form where your export button is, and have the filename in that.

Let's say that you create a textbox called ExportFilename on your SecondaryMenuF form right below your button. Now, in the FILENAME parameter for the macro that performs the export, just put:

=[Forms]![SecondaryMenuF]![ExportFilename]

We learned about this technique in Access 202, lesson 2, where we shared values between two forms. You can use this same notation in macros, queries, VBA code, etc.

The other way you could do it, would be to use the InputBox command to prompt the user for the filename when the macro runs. Here's the syntax:

=InputBox(Prompt,WindowTitle,DefaultValue)

So in this case, you would say:

=InputBox("Export Filename","Export","C:\ExportFile.xls")

And that would prompt the user for the filename, giving them a default vallue of C:\ExportFile.xls. We learned about InputBox in Access 306.

There is another way you could do it... but that would involve introducing the FILE and FOLDER controls to your database. I personally don't like pulling in extra controls into my database unless absolutely necessary, but Microsoft does make nice controls that you can browse for files and folders with. I cover them in my Visual Basic 106 class, and the same controls work in Access too.

You're still going to have to refer to the filename you select in your macro though - so you'll still need the Forms!FormName!Field notation.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Microsoft Access 308.
 

Next Unseen

 
 
What's This?

 

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: 11/14/2026 8:06:48 PM. PLT: 1s