Solved

How do I create a button on an Access form that let's the user browse to a file and save it to a folder defined in a form field?

Posted on 2014-09-25
6
246 Views
Last Modified: 2014-10-27
I have a form where users can create a new record. This record is associated with a file on the server. Instead of them creating a record and then having to go to the server and save it all manual like, I thought I'd let them click a button, browse to the file on the flash drive, and save it to the folder that's in a form field on the form.  So let's say they're creating a new record and choose C1 as the directory. They fill in the info, then click a button that says "save file to the server." This opens the window and let's them browse to the file. They click the file and it saves it to the C1 directory.

It's basically just saving a file to the server, but it keeps them from having to create a record, then going into windows explorer, copying, blah blah blah (plus it can allow me to force them to use the program instead of putting the file on the server and not creating a record for it).
0
Comment
Question by:Kevin Smith
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 38

Expert Comment

by:PatHartman
ID: 40344265
This is the help entry to the FileDialogFilePicker for Access 2013.  It should work as far back as A2007 and possibly earlier.  The code opens the standard file dialog which lets the user browse to a folder and select one or more files.  You can control whether or not to allow multi-select.

http://msdn.microsoft.com/en-us/library/office/ff196794(v=office.15).asp
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 40344311
0
 
LVL 51

Accepted Solution

by:
Gustav Brock earned 500 total points
ID: 40345561
Or you can import the attached module with ready-to-go functions:

    strFile = SaveFileNameDlg("Test", "Export File (*.txt)|*.txt", "c:\Temp", "file.txt")

It doesn't require a reference to anything.

/gustav
basFileDialogue.bas
0
Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

 
LVL 31

Expert Comment

by:Helen Feddema
ID: 40346090
Something is missing here.  You speak of creating a new record, which would be a record in an Access table, but then of browsing for a file on a flash drive.  If the file is already there, how does that relate to the new table record?  If you are creating a text file from VBA code, say using components of the FileSystemObject, then you can save it to the folder path picked up from the form, no need to browse for anything.

BTW, I can confirm that the FilePicker and FolderPicker dialogs work fine in Access 2003 and up -- the FileDialog object was introduced in Office XP (Access 2002).
0
 

Author Closing Comment

by:Kevin Smith
ID: 40406743
Thanks to everyone for your help!
0
 
LVL 51

Expert Comment

by:Gustav Brock
ID: 40406748
You are welcome!

/gustav
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

627 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question