Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 252
  • Last Modified:

save tables the current directory

Hello!

I want to record the result of a request and to  save it like a excel file.
Hence I use that function:
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel97, "ShowList_Request", "list.xls"

But it saved it in c:\Data. I would like to save it in the current directory, or in the proper one, (correct workspace of the user whatever the computer used).
Could you help me?
Thank you in advance!
0
Noero
Asked:
Noero
1 Solution
 
Rahul_GadeCommented:

You may want to try out with, you will probably need to add some safty mechanism to this string operations.

Dim strPath As String
strPath = Left(CurrentDb.Name, InStrRev(CurrentDb.Name, "\"))
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12, "ShowList_Request", strPath + "list.xls"

-Rahul
0
 
NoeroAuthor Commented:
Thank you Rahul, great clue!
0
 
rajvihariCommented:
In the DoCmd commamd you can provide entire path instead of 'list.xls' like "d:\myFolder\link.xls"
0

Featured Post

Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now