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

DoCmd.OutputTo fails in some pcs 1

Status
Not open for further replies.

ernigles

Technical User
Jan 15, 2009
31
ES
Hi, in some pcs in which i have made this comprobation, the command DoCmd.OutputTo doesn't run; when this code line enters the procedure stops running. The code line is:

DoCmd.OutputTo acOutputReport, "reportName", acFormatSNP, CurrentProject.Path & "\temp1.snp", False

Can it be due to the references? Or to the version and placement of any .dll file?

Thansk in advance for any help given.
 
Are there any obvious differences between those that do and don't work? eg versions of Access, service pack levels etc.

John
 
Thans for reply jrbarnett. Here are the results of checking in different systems (DoCmd.OutPut Failure Yes or No):


Windows XP Home Edition 2002 SP2 – Access 2000 Spanish No

Windows XP Home Edition 2002 SP2 – Access 2002 English (Office 2002 Professional) No

Windows XP Professional 2002 SP2 – Access 2003 SP2 (Office professional edition) No

Windows XP Professional 2002 SP2 - Access 2007 No

Windows XP Professional 2002 SP2 (theme de Vista) – Access 2007 No

__________________________________________________________________________________________
Windows XP Professional 2002 SP2 – Access 2002 Spanish Yes

Windows XP Home 2002 SP2 – Access 2002 SP3 Spanish Yes

Windows XP Home Edition 2002 SP2 – Access 2003 Spanish (Office professional edition) Yes

Windows XP Professional 2002 SP2 (with Vista Theme) - Access 2003 (Office professional edition) Yes
 
Have you tried upgrading office to the latest SP for the respective versions?
 
Just a trouble-shooting thought: Play with the argument
CurrentProject.Path & "\temp1.snp"

Try a text string, no vars.

[purple]If we knew what it was we were doing, it would not be called
research [blue]database development[/blue], would it? [tab]-- Albert Einstein[/purple]​
 
In the cases that don't work check and see if acFormatSNP returns a value... you might try:

Code:
DoCmd.OutputTo acOutputReport, "reportName", "Snapshot Format (*.snp)", CurrentProject.Path & "\temp1.snp", False

I forgot but that constant did not exist in Access 97. It stands to reason that some botched local version may have the same problem.
 
lameid GKChesterton,

I have tried replacing acFormatSNP by "Snapshot Format (*.snp)", replacing CurrentProject.Path & "\temp1.snp" by "C:\temp1.snp", and both things together. It didn't work any of them.

I don't know if usign a numeric value corresponding to acFormatSNP could solve the problem. I would need to know the corresponding number.

Thanks.
 
Library References possible.
Microsoft ActiveX Data Objects 2.5 Library, on my system, possible.

[purple]If we knew what it was we were doing, it would not be called
research [blue]database development[/blue], would it? [tab]-- Albert Einstein[/purple]​
 
On my system the value of acFormatSNP is "Snapshot Format (*.snp)" not a number.

The constants that the output to takes are the same as the text values of the file type when you do a manual export. My next suggestion would be to check what the text says for snapshot files on systems that do not work and try that text if different than what you have already tried.

Have you fully patched the problem systems?
Do you get an error message (what is it)?
Can the problem machines run the report without error?
Can they output to another format to the same directory?
 
GKChesterton, how can i check if it's a references problem? I suppose by unchecking the corresponing checkbox in the references list and viewing then if the problem has been solved?

lameid, how can i check what the text says for eported snapshot files? Do you mean manually, and using what appears in the textbox of the export window?

Have you fully patched the problem systems?
Do you get an error message (what is it)?
Can the problem machines run the report without error?
Can they output to another format to the same directory

- The application is done to be given to the final user, so patching the problem systems wouldn't have any sense in this case.

- I don't get any error message, just the code stops.

- No, if they would give an error perhaps it could be handled, there's no error but the code just stops in thst linecode.

- I haven't tried: in order to do that, which would be the text for replacing each constant, like acFormatSNP by "Snapshot Format (*.snp)" in case of snp format?

Thank you.
 
Yes I mean the text that appears in the export window.

Right from inside Access help...

AcFormat can be one of these AcFormat constants.
acFormatASP
acFormatDAP
acFormatHTML
acFormatIIS
acFormatRTF
acFormatSNP
acFormatTXT
acFormatXLS

I'd try the one for XLS.

The application is done to be given to the final user, so patching the problem systems wouldn't have any sense in this case.

If you patch it and it works you can tell people this feature does not work if you are not running a patched system. It is not like it there is going to be some magical way to get it to work if it is a bug.
 
Thanks lameid.

About AcFormat constants, i meaned the text for replacing these constants if they don't work, but i'll try first with them.

I'll try next patching office versions.
 
With the constant acFormatXLS , it works pefectly.

About the text that appears in the textbox of the export window, with

Code:
    DoCmd.OutputTo acOutputReport, "ReportName", acFormatSNP, , True

it neither works, and with

Code:
    DoCmd.OutputTo acOutputReport, "ReportName"

after choosing the file format ('Snapshot format'), it's just the name of the report with the extension .snp, and in the textbox 'Save as type' appears 'All files'.

I have tried the code

Code:
DoCmd.OutputTo acOutputReport, "ReportName", "Snapshot format, CurrentProject.Path & "\temp1.snp", False

and voila, it works.

Thank you lameid. It's solved for the problem pcs.

But, if in other pcs like yours the corresponding text is "Snapshot format (.snp)", or other, how can i addapt the code for each case, and consider all of them?
 
I don't find where you describe the "stops running" part. Is there an error message -- and if not, do you have error-handling set to "break on all errors"? Or is it like a break-point for debugging (in which case you may need to decompile due to an Access bug)?

About trouble shooting library references: Correct, just try some fiddling and see what gives. But also, if you compare those settings on your different PCs then maybe you'll find the culprit. The order of the selections can be critical.

[purple]If we knew what it was we were doing, it would not be called
research [blue]database development[/blue], would it? [tab]-- Albert Einstein[/purple]​
 
Thanks GKChesterton.

By now, i'll try to implement the function with a text replacing the AcFormat constants, it has given me at the moment some result.

Anyway, after i'll see also the references and i'll tell.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top