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 a 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 it that display a default file name, like perhaps setting a report property?
 
you can create a macro using the output to function this lets you to add a filename in the file field

I will try my best to help others so will others do!!!!!
IGPCS
Brooklyn, NY
 
I am already using that, what i also want is a default file name in that field. Thanks.
 
IGPS,

You say you want a dialog box with the default file name already included, and that you are currently using the Outputto command.

The proper syntax of that command shows this:
Code:
[i]expression[/i].OutputTo(ObjectType, ObjectName, OutputFormat, [b]OutputFile[/b], AutoStart, TemplateFile, Encoding)

This above code example from:

However, if you are wanting a prompt for the file that inputs the default save-as file name, you can use the FileDialog Property.

MSAccessHelp said:
FileDialog Property
See AlsoApplies ToExampleSpecificsReturns a FileDialog object which represents a single instance of a file dialog box.

expression.FileDialog(dialogType)
expression Required. An expression that returns one of the objects in the Applies To list.

dialogType Required MsoFileDialogType. The type of file dialog box.

MsoFileDialogType can be one of these MsoFileDialogType constants.
msoFileDialogFilePicker
msoFileDialogFolderPicker
msoFileDialogOpen
msoFileDialogSaveAs

Example
This example displays the Save As dialog box.

Dim dlgSaveAs As FileDialog

Set dlgSaveAs = Application.FileDialog( _
FileDialogType:=msoFileDialogSaveAs)

dlgSaveAs.Show

This example displays the Open dialog box and allows a user to select multiple files to open.

Dim dlgOpen As FileDialog

Set dlgOpen = Application.FileDialog( _
FileDialogType:=msoFileDialogOpen)

With dlgOpen
.AllowMultiSelect = True
.Show
End With

--

"If to err is human, then I must be some kind of human!" -Me
 
Thanks for reply. This solution i think neither allows to specify a default file name.
 
Oops. Sorry, I responded to the responder instead of the asker of the question. [blush] [smile].

Anyway...

Bresart, (yay, I think I got it right this time!) [wink],

The FileDialog DOES allow for a default file name. You enter that information (if desired) in your VBA module where using the FileDialog property. You can tell it to automatically choose the save-as filetype of DOC, and have the default file name set to "DaveyJones" if you want to.

[smile]

--

"If to err is human, then I must be some kind of human!" -Me
 
Thank you again. It's a shame i have Access 2000 and that works from Access XP and later.
 
Thank you again. It's a shame i have Access 2000 and that works for Access XP and later.
 
Hmmmm.

Try having a look here:

Either those are good references specifically for Access 2000 at that link, or the guy didn't notice the 2000 part. But it's hard to know as the original poster of that question didn't respond to verify whether or not that helped.

--

"If to err is human, then I must be some kind of human!" -Me
 
I see it only works for the full comercial version of Access. I consider that the most appropriate would be leaving it with OutputTo, without the default filename but with a guaranteed good-working.

Thank you.
 
full comercial version of Access

I wasn't aware there was anything but that. What else are you using?

--

"If to err is human, then I must be some kind of human!" -Me
 
Yes, i am using this, but the application won't be serviceable for many people using runtime version.
 
Ahhh, ok. I either forgot, or just totally did not know about the run-time version.

Here is some info abut it here:

I doubt that will help with your problem, though.

Thanks for the info.

[smile]

--

"If to err is human, then I must be some kind of human!" -Me
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top