|
Home > Archive > MS Access Database with External Data > September 2005 > Allow User to Select Path of Import File
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Allow User to Select Path of Import File
|
|
| Dave C 2005-09-28, 8:26 pm |
| 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 2005-09-28, 8:26 pm |
| Try this
Sub GetFile(Control)
Dim retFile As String, dlg As Variant, s As String
Set dlg = Application. FileDialog(msoFileDi
alogFilePicker)
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
"Dave C" <DaveC@discussions.microsoft.com> wrote in message
news:D852413D-D1F8-4CB5-B0F3- 5526DEDB6B3C@microso
ft.com...
>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
>
>
| |
| John Nurick 2005-09-29, 3:25 am |
| 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
On Wed, 28 Sep 2005 15:07:01 -0700, Dave C
<DaveC@discussions.microsoft.com> wrote:
>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
>
>
--
John Nurick [Microsoft Access MVP]
Please respond in the newgroup and not by email.
| |
| Roger Carlson 2005-09-29, 9:24 am |
| 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.
--
--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...SUBED1=ACCESS-L
"Dave C" <DaveC@discussions.microsoft.com> wrote in message
news:D852413D-D1F8-4CB5-B0F3- 5526DEDB6B3C@microso
ft.com...
> 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
>
>
|
|
|
|
|