-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
You're not using the OutputTo parameters correctly. The OutputFile name
is the 4th parameter, not the 2nd. The following is the correct syntax
for the OutputTo function:
DoCmd.OutputTo(ObjectType, ObjectName, OutputFormat, OutputFile,
AutoStart, TemplateFile, Encoding)
Here are the Access Help article's info on the parameters:
== begin quote ==
ObjectType Required AcOutputObjectType. The type of object to output.
AcOutputObjectType can be one of these AcOutputObjectType constants.
acOutputDataAccessPage Not supported.
acOutputForm
acOutputFunction
acOutputModule
acOutputQuery
acOutputReport
acOutputServerView
acOutputStoredProcedure
acOutputTable
ObjectName Optional Variant. A string expression that's the valid name
of an object of the type selected by the ObjectType argument. If you
want to output the active object, specify the object's type for the
ObjectType argument and leave this argument blank. If you run Visual
Basic code containing the OutputTo method in a library database,
Microsoft Access looks for the object with this name, first in the
library database, then in the current database.
OutputFormat Optional Variant. The output format, expressed as an
AcFormat constant. If you omit this argument, Microsoft Access prompts
you for the output format.
AcFormat can be one of these AcFormat constants.
acFormatASP
acFormatDAP
acFormatHTML
acFormatIIS
acFormatRTF
acFormatSNP
acFormatTXT
acFormatXLS
OutputFile Optional Variant. A string expression that's the full name,
including the path, of the file you want to output the object to. If you
leave this argument blank, Microsoft Access prompts you for an output
file name.
AutoStart Optional Variant. Use True (–1) to start the appropriate
Microsoft Windows–based application immediately, with the file specified
by the OutputFile argument loaded. Use False (0) if you don't want to
start the application. This argument is ignored for Microsoft Internet
Information Server (.htx, .idc) files and Microsoft ActiveX Server
(*.asp) files. If you leave this argument blank, the default (False) is
assumed.
TemplateFile Optional Variant. A string expression that's the full
name, including the path, of the file you want to use as a template for
an HTML, HTX, or ASP file.
Encoding Optional Variant.
== end quote ==
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv
iQA/AwUBQfbGcIechKqOuFEgEQJc8gCgvRKmCXfGb9FbdCEmQdPHvV 7vzkMAoIjU
8Flzj3eLS1oO/ZDnR/hAOE0Z
=rrUL
-----END PGP SIGNATURE-----
Wayne wrote:
I'm trying to save a report as a snapshot. If I use this code:
DoCmd.OutputTo acOutputReport, "Snapshot Format (*.snp)", , False
everything works fine, the file save dialogue box appears and the
"Report's Name.snp" is entered as the file name to be saved and the
file can be saved to the specified location.
If however I try to give the report a different name by entering an
object name like this:
DoCmd.OutputTo acOutputReport, "Test", "Snapshot Format (*.snp)", ,
False
the file save dialogue box appears, "Test.snp" is entered as the file
name to be saved, but the file won't actually save. The file save
dialogue box disappears, but the file isn't saved to the specified
location.
Is this a bug or am I missing something. Any help would be greatly
appreciated.