Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
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
Medium Priority
?
254 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 39

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 2000 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
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
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…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

719 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