Select a Folder and file name to Save to

Hi,

I have this code:

DoCmd.TransferText acExportDelim, , "tblData", "C:\Documents and Settings\Desktop\text.csv"
MsgBox "Conversion/Export completed!", vbInformation, "Export CSV"

Which succesfully create a CSV file from tblData.  However, what i would like to be able to do is get the user to select the folder in which they want to save the file in AND select a file name, instead of having the code doing it automatically 'C:\Documents and Settings\Desktop\text.csv'.

I have this code which lets the user select the folder:

Private Sub FindFolder_Click()
Dim spath As String

   Folder.Value = ""
   
  'The call can not have a trailing slash, so
  'strip it from the path if present
   spath = UnqualifyPath((FolderLocation.Value))
   
  'call the function, returning the path
  'selected (or blank if cancelled)
   Folder.Value = BrowseForFolderByPath(spath)

End Sub

I hope some one can help me with this matter.

Regards,
Anthony
d10u4vAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rey Obrero (Capricorn1)Commented:
you will need the codes from here

http://www.lebans.com/callbackbrowser.htm

A2KCallbackBrowse.zip
0
d10u4vAuthor Commented:
Yeah, I have got them, but i need to allow the user to type in their own file name to 'Save As'

Anthony
0
frankyteeCommented:
a cheap and quick way to replace the filename argument
"C:\Documents and Settings\Desktop\text.csv"
is to simply let the user enter it into a textbox and then check that the directory exists (using dir function) before using the docmd method.
or just use the windows common dialog box.
0
d10u4vAuthor Commented:
How do i join two variables together in code.  For example, if i have a text box which will have the directory and file name in [Text1], and have another text box [text2] which will have the user entered file name, hoe can i join them together in the transfer code:

DoCmd.TransferText acExportDelim, , "tblData", "ENTER THE TWO VARIABLES HERE"
MsgBox "Conversion/Export completed!", vbInformation, "Export CSV"

Anthony
0
Rey Obrero (Capricorn1)Commented:

DoCmd.TransferText acExportDelim, , "tblData", me.text1 &"\"& me.text2
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.