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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Identify default database folder via VBA 2

Status
Not open for further replies.

DrSimon

IS-IT--Management
Dec 14, 2001
674
GB
I'm using DoCmd.RunCommand (acCmdOutputToRTF) to export reports to rtf. I can't find any other output parameters to so it always creates a file with the name of the report putting into the default database folder. I want to then rename the file, so it would useful to know what that folder is within the code. Does anyone know the property?
Thanks
Simon Rouse
 
If you're using 2000+ version:

[tt]currentproject.path[/tt]

for previous versions

[tt]currentdb.name[/tt]

- for the last one, you'd need to strip of the db name at the end of the path, though

Roy-Vidar
 
Thanks for trying - I know that property, but that's not what I'm after. If you go into Options/General there's a property 'default database folder' and that's the folder that acCmdOutputToRTF uses which is independant of the current database itself. It's more of an application property than s database one.
Simon Rouse
 
You can set the path in the code
Code:
DoCmd.OutputTo acOutputTable, "YourTableName", _
    acFormatRTF, "C:\FileName.rtf", True


________________________________________________________
Zameer Abdulla
Help to find Missing people
My father was a realistic father; not a vending machine dispense everything I demanded for!!
 
Didn't even occur to me you where not specifying path in code, but you can use GetOption to retrieve it:

[tt]GetOption("Default Database Directory")[/tt]

Roy-Vidar
 
Thanks Zameer. I thought I had tried to do something like that but it kept on telling me that acFormatRTF was an invalid format or something so I gave up thinking it was a bug. That's exactly what I wanted in the first place.
Simon Rouse
 
And a star to you too Roy-Vidar. While I don't need it now for this problem, somehow I'd never seen this method before (nor SetOption). I will keep it in mind in future.
Thanks
Simon Rouse
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top