Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Importing / Linking / September 2005

Tip: Looking for answers? Try searching our database.

Allow User to Select Path of Import File

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dave C - 28 Sep 2005 23:07 GMT
I have a need to import a text file into Access but want to give the user the
flexibility of selecting the path where the file is being imported from. At
the moment I've tested with a fixed path in the code and the import works
fine, but this is being more restrictive than I want to be. I'd appreciate
any help in how to achieve this.

Thanks,  Dave


Amy Blankenship - 29 Sep 2005 01:04 GMT
Try this
Sub GetFile(Control)
   Dim retFile As String, dlg As Variant, s As String
   Set dlg = Application.FileDialog(msoFileDialogFilePicker)
   With dlg
       .InitialFileName = CodeProject.Path
       If .Show = -1 Then s = .SelectedItems(1)
   End With
   If s <> "" Then
       retFile = Right(s, Len(s) - InStrRev(s, "\"))
       Control.Value = retFile
   End If
End Sub

HTH;

Amy

>I have a need to import a text file into Access but want to give the user
>the
[quoted text clipped - 5 lines]
>
> Thanks,  Dave
John Nurick - 29 Sep 2005 07:19 GMT
This isn't quite as simple as Application.FileDialog but is more
flexible and works in all versions of Access:

http://www.mvps.org/access/api/api0001.htm

>I have a need to import a text file into Access but want to give the user the
>flexibility of selecting the path where the file is being imported from. At
[quoted text clipped - 3 lines]
>
>Thanks,  Dave

--
John Nurick [Microsoft Access MVP]

Please respond in the newgroup and not by email.
Roger Carlson - 29 Sep 2005 14:02 GMT
If you'd like to see a small Access database sample based on the link that
John provided, I've got one on my website: (www.rogersaccesslibrary.com).
It is called "PictureLoad.mdb".  This does not choose a file for importing,
rather choosing a picture for adding to the database, but the methodology is
the same.  The only difference is what you choose to do with the selected
file.

Signature

--Roger Carlson
 Access Database Samples: www.rogersaccesslibrary.com
 Want answers to your Access questions in your Email?
 Free subscription:
 http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L

> I have a need to import a text file into Access but want to give the user the
> flexibility of selecting the path where the file is being imported from. At
[quoted text clipped - 3 lines]
>
> Thanks,  Dave
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.