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
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
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
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
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
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
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.
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.
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
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
So did you verify that snp is a format that is available for you to use?
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
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
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
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
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
In order to avoid confusion, I yield to rockiroads
lol, you cant just run away. My suggestion may not work.
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
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
:)
And my spanish has improved slightly also, lol.
And my spanish has improved slightly also, lol.
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!
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
Open in new window