TransferText Macro - Variable File Name

  • Thread starter Thread starter Linda F.
  • Start date Start date
L

Linda F.

I am building a database that will import a comma
delimited file (with a variable name). I can get the
Macro to work if I put in the name but I would liek to
have a box open that the user could select from the
network drive the files are located.

Any ideas?

Thanks,
Linda Fevold
 
What you're asking is really more sophisticated than you
might think. I know it was for me but I believe I have
just the program for you to accomplish your task. Some
of the code is borrowed, with the proper credits to the
original programmer of course, and some of it's mine.
I'll be happy to share it with you. If you are
interested I'll put it in a zip file and send it to you.
You can reach me at:
m s p r e n z |at| r f c o n s u l t i n g |dot| c o m

Sorry about writing my e-mail address like that. I got
some bogus e-mail spam. it was so bad it spamed me right
out of my previous e-mail address. I believe they got it
from this forum. I'm still mad about it today but that's
life on the web I guess.

Marty
 
Marty:

I was searching the NG for almost the same reason as Linda F.

I am exporting using TransferText and OutputTo - 3 qury files in total. I
want the user to choose the Path only (filenames assigned) by browsing to
the location. I would like something similar to the GetOpenFilename method
in Excel. The problem is that I'm using Access 97 and don't see any such
method.
 
This will get it done, but you need to add a reference to: comdlg32.ocx

Public Function dg_GetFile(DialogTitle As String, Optional InitDir A
String, Optional FileFilter As String, Optional ShowSaveDLG As Boolea
= False) As String
Dim cdlg As CommonDialog
On Error GoTo err_FileDlg
Set cdlg = New CommonDialog
cdlg.CancelError = True
cdlg.DialogTitle = DialogTitle
cdlg.Filter = FileFilter
cdlg.InitDir = InitDir
cdlg.ShowOpen
If cdlg.FileName <> "" Then
dg_GetFile = cdlg.FileName
End If

err_FileDlg_Exit:
On Error Resume Next
Set cdlg = Nothing
On Error GoTo 0
Exit Function
err_FileDlg:
'Sys_Box Error, 0, Err & " - dg_GetFile"
Resume err_FileDlg_Exit
Resume

End Function


USAGE:
dg_GetFile("Find Source Data", "", "csv Files|*.csv|Database|*.mdb"
 
Back
Top