Hi, i have a form with a Print button, with the next code:
DoCmd.OutputTo acOutputReport, "infGeneralParcial_paginador", acFormatSNP, CurrentProject.Path & "\temp1.snp", False
DeleteFile ("" & CurrentProject.Path & "\temp1.snp")
DoCmd.OutputTo acOutputReport, "infGeneralSubinfINDICE_paginador", acFormatSNP, CurrentProject.Path & "\temp2.snp", False
DeleteFile ("" & CurrentProject.Path & "\temp2.snp")
If Me.Marco45.Value = 1 Then 'vista prel.
DoCmd.OpenReport "infGeneralParcial", acViewPreview
DoCmd.Close acForm, "frmImprimir"
DoCmd.SelectObject acReport, "infGeneralParcial"
DoCmd.Maximize
DoCmd.ShowToolbar "Ventana2", acToolbarYes
DoCmd.ShowToolbar "Vista Preliminar", acToolbarNo
ElseIf Me.Marco45.Value = 2 Then 'impr. a impresora
Application.Echo False
DoCmd.OpenReport "infGeneralParcial", acViewPreview
DoCmd.RunCommand acCmdPrint
DoCmd.Close acReport, "infGeneralParcial"
ElseIf Me.Marco45.Value = 3 Then 'impr. a archivo
DoCmd.OutputTo acOutputReport, "infGeneralParcial", acFormatSNP, , True
End if
Application.Echo True
The Marco45 is an options frame in which the printing mode is selected. That code is not working, none of the three if statements enter (i have put msg boxes for testing that). But i have tested that if the two DoCmd.OutputTo and the two DeleteFile statemens at the beginning of the procedure are deleted, the if statement for the printing selected option enters correctly.
Is there any solution for keeping the two DoCmd.OutputTo and the two DeleteFile statements in a working code?
Thanks for any help given.
DoCmd.OutputTo acOutputReport, "infGeneralParcial_paginador", acFormatSNP, CurrentProject.Path & "\temp1.snp", False
DeleteFile ("" & CurrentProject.Path & "\temp1.snp")
DoCmd.OutputTo acOutputReport, "infGeneralSubinfINDICE_paginador", acFormatSNP, CurrentProject.Path & "\temp2.snp", False
DeleteFile ("" & CurrentProject.Path & "\temp2.snp")
If Me.Marco45.Value = 1 Then 'vista prel.
DoCmd.OpenReport "infGeneralParcial", acViewPreview
DoCmd.Close acForm, "frmImprimir"
DoCmd.SelectObject acReport, "infGeneralParcial"
DoCmd.Maximize
DoCmd.ShowToolbar "Ventana2", acToolbarYes
DoCmd.ShowToolbar "Vista Preliminar", acToolbarNo
ElseIf Me.Marco45.Value = 2 Then 'impr. a impresora
Application.Echo False
DoCmd.OpenReport "infGeneralParcial", acViewPreview
DoCmd.RunCommand acCmdPrint
DoCmd.Close acReport, "infGeneralParcial"
ElseIf Me.Marco45.Value = 3 Then 'impr. a archivo
DoCmd.OutputTo acOutputReport, "infGeneralParcial", acFormatSNP, , True
End if
Application.Echo True
The Marco45 is an options frame in which the printing mode is selected. That code is not working, none of the three if statements enter (i have put msg boxes for testing that). But i have tested that if the two DoCmd.OutputTo and the two DeleteFile statemens at the beginning of the procedure are deleted, the if statement for the printing selected option enters correctly.
Is there any solution for keeping the two DoCmd.OutputTo and the two DeleteFile statements in a working code?
Thanks for any help given.