Set default export type & save file name

maGemme

Registered User.
Local time
Today, 08:46
Joined
Mar 24, 2010
Messages
62
Hi,

I created a nice fancy report for my team, I have a button on a form that exports it to a file. Right now when I click it it gives me the default option box allowing me to choose what type of document I want to export (HTML, EXCEL, text, snp, etc.)

How do I set this to be Snapshot Format by default and skip the dialog box?

Also, once I have chosen the type I want and click ok, the windows API comes up asking me where I want to save it and to give it a name. Is there a way to set the name automatically from choices in drop boxes found on my form?

I have searched on this but I guess I can't find proper keywords because my searches haven't returned much.
 
The method you are using to export will include arguments to set these parameters. What is the command you are using?

Incidentally I would discourage you from using Snapshot. Microsoft deprecated this format with Access 2007 with no backwards compatibility.

Users have to install a Snapshot viewer. As a domain admin I find this pain since users have no rights to install programs and I either have to convert it to pdf for them or install the viewer.
 
The method you are using to export will include arguments to set these parameters. What is the command you are using?

Incidentally I would discourage you from using Snapshot. Microsoft deprecated this format with Access 2007 with no backwards compatibility.

Users have to install a Snapshot viewer. As a domain admin I find this pain since users have no rights to install programs and I either have to convert it to pdf for them or install the viewer.

I completely agree with what you said but I'm unfortunately limited here in what I can use. We have Access 2000 and am unable to export to pdf. Snapshot is far from my first choice but it's the only one that allows me to send charts as well as data on a report. Since everyone who uses the reports has the Office 2000 suite installed, installing the snapshot viewer is not an issue for me.

As for the code I use, it's the code supplied by the command button wizard by default :

Code:
    Dim stDocName As String
    stDocName = "rptMonthly"
    DoCmd.OutputTo acReport, stDocName
 
DoCmd.OutputTo acReport, stDocName, stFormat, stFileName etc

This is for A2003 but I assume it was the same for A2000.

http://msdn.microsoft.com/en-us/library/aa220433(office.11).aspx

BTW If you ever do need to make a pdf from any program, CutePDF is a good solution because it emulates a printer.

Thank you very much, the link was for Access 2003 but I was able to find similar info on acc2000.

As for CutePDF I agree it's a good solution but we can't install that due to company restrictions.

Your answer was very helpfull, thank you again!
 
I am using access 2007 with VB code and would like to do a similar method for the savefiledialog method, where the filename would be filled in by default for the Save As entry with the primary key, where the table name is "Log" and the primary key is "ID" I was able to get the following code to function, but not with the mentioned above working.

Private Sub CopyFile_Click()
Dim strFilter As String
Dim myStrFilter As String
Dim strInputFileName As String
Dim strSaveFileName As String
strFilter = ahtAddFilterItem(strFilter, "Image Files (*.jpg)", "*.jpg")
strInputFileName = ahtCommonFileOpenSave( _
Filter:=strFilter, OpenFile:=True, _
DialogTitle:="Select GPS Image file to Link to Log ID...", _
Flags:=ahtOFN_HIDEREADONLY)

strFilter = ahtAddFilterItem(myStrFilter, "Image Files (*.jpg)", "*.jpg")
strSaveFileName = ahtCommonFileOpenSave( _
OpenFile:=False, Filter:=strFilter, _
DialogTitle:="Save As: (Input Current Log ID Number)", _
Flags:=ahtOFN_OVERWRITEPROMPT Or ahtOFN_READONLY)


'If fhe user has entered a file greater than 1.jpg
If strSaveFileName >= "1.jpg" Then

'Copy file from source to destination
FileCopy (strInputFileName), (strSaveFileName)

Call DisplayImage(Me.ImageFrame, Me!txtImageName & ".jpg")

MsgBox "JPEG File was copied"

Else
MsgBox "You clicked Cancel in the file dialog box."
End If
End Sub
 

Users who are viewing this thread

Back
Top Bottom