Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Soft code the current DB path? 2

Status
Not open for further replies.

bandclar

Technical User
Feb 13, 2004
5
US
I cannot find the equivalent of "AppPath" (VB5) in Access. Just trying to soft code the location of the open database in order to save the Excel file as referenced below.

DoCmd.OutputTo acOutputQuery, "qryOpenOfficesExcel", acFormatXLS, "OpenOfficesExcel.xls", True

Can anyone tell me what to put before "qryOpenOfficesExcel"so that the Excel file will be saved in the same folder as the open DB?

 
Application.CurrentProject.Path will return the path that the database is in.
 
To get the Full path name there are two options.

Using DAO:

CurrentDB.Name - This will display the full path and name of the db

Using ADO:

CurrentProject.Path - This will display just the path of the db

HTH
Mike

[penguin] Dooobie...Doobie......Dooo

Beware the penguins
 
Thanks so much to Randy700 and mgolla for their quick replies - a star to both of you!

This did the trick:
DoCmd.OutputTo acOutputQuery, "qryOpenOfficesExcel", acFormatXLS, CurrentProject.Path & "\" & "OpenOfficesExcel.xls", True
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top