Avatar of onesimolisandro
onesimolisandro
 asked on

SendObject and OuputTo methods, don´t work with acFormatSNP Ouput format on Access 2003. What can I do ?

I´ve red three or four solutions here to export .snp files, with two methods:
SendObject, or OuputTo. But, when I change the Ouput format to .snp file, an error message, # 2282, stop the procedure and explains that Object format I´m trying to create is not available. What is wrong ?

best regards

Microsoft Access

Avatar of undefined
Last Comment
rockiroads

8/22/2022 - Mon
Jeffrey Coachman

onesimolisandro,

It would have been helpfull to troubleshoot this if you had posted the code you were trying.
Agreed?
;-)

You will get that error if you do not spell "acFormatSNP" correctly or you put the wrong argument or value in this space.

Check your syntax, it should look like this:
DoCmd.SendObject acSendReport, "YourReportName", acFormatSNP, "Person@Email.com", , , "Snap!", "Snapping!", True

JeffCoachman



DoCmd.SendObject acSendReport, "YourReportName", acFormatSNP, "Person@Email.com", , , "Snap!", "Snapping!", True

Open in new window

onesimolisandro

ASKER
Thanks Jeff.  The Problem is only with .snp. When I change  acFormatSNP, by acFormatTXT , code works well. Here is the code.

DoCmd.Echo False
    I = 0
        Do While Not rst.EOF
        I = I + 1
            strCod = rst!CODIGO
            strEmail = rst!emilio
            strarchivos(I) = rst!ARCHIVO
            DoCmd.OpenReport "export1", acViewPreview, , "codigo=" & "'" & strCod & "'"
            DoCmd.OutputTo acOutputReport, "export1", acFormatSNP, "c:\cxc\" & strarchivos(I) & ".snp", False
            DoCmd.Close acReport, "export1"
            rst.MoveNext
        Loop
    DoCmd.Echo True
Jeffrey Coachman

onesimolisandro,

1. You did not make it inherently make it clear if the code you posted Works or does Not Work.
Please clarify.

2. Please always post the *complete* code.  
There are no declarations in this code.
What is "strarchivos"?
What is "I"?
Again, if you post the complete code, we could save the time we spend asking and answering these questions.
Make sense?

3. "The Problem is only with .snp."
Then can you post the complete "snp" code that does not work?

The code you posted above works fine for me.

JeffCoachman
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
rockiroads

onesimolisandro, it seems possibly acFormatSNP is not a valid option during runtime.

Take a query for example, try exporting that to snp but DONT specify output format. It should prompt you for it.

eg

DoCmd.OutputTo acOutputQuery, "Query4", , "c:\temp\q3.snp", True

Now this popup box that appears, does snp format appear? If not there lies your problem. It might be a check/repair or reinstall of access or someway of getting snp available again.
onesimolisandro

ASKER
Hi Jeff, sorry by my english.
Next code, works ok.

Private Sub export_Click()
On Error GoTo Err_export_Click

Dim db          As DAO.Database
Dim tabla       As DAO.Recordset
Dim strSQL      As String
Dim scodigo      As String
Dim semilio      As String
Dim I As Integer
Dim strarchivos(6)
strSQL = "SELECT codigo, emilio, archivo From Correos"
Set db = CurrentDb()
Set tabla = db.OpenRecordset(strSQL)
tabla.MoveFirst
DoCmd.Echo False
I = 0
Do While Not tabla.EOF
I = I + 1
scodigo = tabla!CODIGO
semilio = tabla!emilio
strarchivos(I) = tabla!ARCHIVO
DoCmd.OpenReport "exportrep", acViewPreview, , "codigo=" & "'" & scodigo & "'"
DoCmd.OutputTo acOutputReport, "exportrep", acFormatTXT, "c:\cxc\" & strarchivos(I) & ".txt", False
DoCmd.Close acReport, "exportrep"
tabla.MoveNext
Loop
DoCmd.Echo True
MsgBox "trabajo terminado", vbInformation

tabla.Close
Set tabla = Nothing
db.Close
Set db = Nothing

Exit_export_Click:
    On Error Resume Next
    tabla.Close
    Set tabla = Nothing
    db.Close
    Set db = Nothing
    Exit Sub

Err_export_Click:
    MsgBox "error en la ejecución." _
    & vbCrLf & vbCrLf & "Error " & Err.Number & ": " _
    & vbCrLf & vbCrLf & Error, vbExclamation
    Resume Exit_export_Click

End Sub

But when I only change the OutputFormat on "Do.cmdOutputTo", from txt to snp, it doesn´t work
error # 2282. Message in English, is something like "Object format you try to create, is not available"
Please look at the change:
DoCmd.OutputTo acOutputReport, "exportrep", acFormatSNP, "c:\cxc\" & strarchivos(I) & ".snp", False
Maybe could be a reference problem ?
best regards

rockiroads

So did you verify that snp is a format that is available for you to use?
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
rockiroads

Having a guess but is this running on a spanish language pc? well I think the language is spanish.

if it is, try specifying the output format in the native language

DoCmd.OutputTo acOutputReport, "export1", "FormatoSnapshot(*.snp)", "c:\cxc\" & strarchivos(I) & ".snp", False

or might need a space because english acFormatSNP is "Snapshot Format (*.snp)"

DoCmd.OutputTo acOutputReport, "export1", "FormatoSnapshot (*.snp)", "c:\cxc\" & strarchivos(I) & ".snp", False
onesimolisandro

ASKER
Hi Rockiroads

Last comment, I sent the whole code to JeffCoachman (please, take a look)
In order to test your new suggestion and discard  installation´s problem, I made next change to the same code:
DoCmd.OutputTo acOutputReport, "exportrep", , "c:\cxc\" & strarchivos(I) & ".snp", False
Code works ok, but asking me for export format. I selected snapshot format each time and 6 different snapshot files were generated (that´s what I expected)
Of course, this solution is only a test, because if I implement it, users will be attached to the PC.
Thanks a lot for your comments.

Best regards
ASKER CERTIFIED SOLUTION
rockiroads

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Jeffrey Coachman

In order to avoid confusion, I yield to rockiroads
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
rockiroads

lol, you cant just run away. My suggestion may not work.
onesimolisandro

ASKER
Hi, Rockiroads.
Yes, it was the problem. I´m from Cali, Colombia. On Access help (spanish), they talk about "Formato de archivo SnapShot" like output format chain. I tried but with no success. Your last comment suggested "FormatoSnapshot(*.snp)". I made changes and... sun bright again. Thanks a lot Rockiroads
rockiroads

:)

And my spanish has improved slightly also, lol.

⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
rockiroads

Blimey Jeff, I just signed up to this expert help notification. Check my inbox which had 0 unread, it has now 136unread. Better start creating a new rule quick!