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

Export report from form: dialog window can display default file name?

Status
Not open for further replies.

Bresart

Programmer
Feb 14, 2007
314
ES
Hi, i need to 'export' a report from a command button of a form and that dialog window open for choosing folder and name of the file but with a default file name displayed in this field.

I am doing it with Docmd.OutputTo, but this command doesn't have this option.

Can anybody say if there is another way of doing that and displaying a default file name, like for example setting a report property?
 
Search for CommonDialog, I think it is what you want.
 
please post only in 1 category

check your posting in ms access forms

I will try my best to help others so will others do!!!!!
IGPCS
Brooklyn, NY
 
Ok, but the question could be about forms (dialog window opens from a command button) as much as about reports (probably related to report properties). Thanks.
 
Remou, thanks for reply. Can you say if you mean the Common dialog API? Or it can be done without API adding?
 
Mainly because in what i have found about API adding ( the sample is about choosing a file, not exporting, and there is no possibility of setting a default file name.

According to there must be a Common dialog control contained in the Access toolbox, but not found in my Access 2000 version, in the More Controls toolbox button nor in menubar (Insert > ActiveX Control).

Other way i have seen is calling directly into the Common Dialog DLL (comdlg32.dll), but it depends of that file and file version i guess.
 
Thanks. It doesn't have the possibility of adding a default file name i think.
 
I think you did not examine the code closely enough. For example:

[tt]strFile=ahtCommonFileOpenSave(,"C:\docs",,,,"ThisDefaultName.txt")[/tt]

Used to call:

[tt]Function ahtCommonFileOpenSave( _
Optional ByRef Flags As Variant, _
Optional ByVal InitialDir As Variant, _
Optional ByVal Filter As Variant, _
Optional ByVal FilterIndex As Variant, _
Optional ByVal DefaultExt As Variant, _
Optional ByVal FileName As Variant, _
Optional ByVal DialogTitle As Variant, _
Optional ByVal hwnd As Variant, _
Optional ByVal OpenFile As Variant) As Variant
' This is the entry point you'll use to call the common
' file open/save dialog. The parameters are listed
' below, and all are optional.[/tt]
 
Thanks, i didn't notice that the calling arguments were self-fixed, and didn't look at the function code.

It is i think the best solution, though has to unavoidably depend on a DLL and its version.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top