How to Get Default path name used by Access?

M

MarkV

I'm using the DoCmd method below to create an excel file
based upon a query. I currently have the path (strPath)
set to a empty string (strPath="") so that access will use
the default directory set in the Tools/Options/General
tab. I want to use a msgbox later to display the path and
file name. I have the strFileName already.

How can I get the default path name being used by Access?
If operator "A" changes the path on his computer I want to
be able to display that value in the msgbox.

thanks
Mark

copy of DoCmd used:
DoCmd.TransferSpreadsheet acExport,
acSpreadsheetTypeExcel8, "qryDataForJBCost", strPath _
& strFileName & ".xls", False
 
D

Douglas J. Steele

You mean the path where the current DB is located? CurrentDb().Name will
give you the complete path and db name, or (Access 2000 and up)
CurrentProject.Path will give you the path.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top