Connecting Tech Pros Worldwide Forums | Help | Site Map

save/print/close

gjameson via AccessMonster.com
Guest
 
Posts: n/a
#1: Dec 12 '06
I have a form that creates a new ticket. Click save on the form and the form
closes and updates the form underneath. I would like to print a report from
this form when I hit the save button all at the same time.

Here is what I have been working with.

Private Sub btnAddNewMaint_Click()
Dim stDocName As String
Dim stReportName As String

stDocName = "frmCustomer"
stReportName = "rptMaintTicket"

MsgBox "Print a copy for tech to printer xxxxxxxx.", vbOKOnly, "Tech
Ticket"

DoCmd.OpenReport stReportName, acPreview
DoCmd.Close

DoCmd.OpenForm stDocName
'refresh
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70

End Sub

This seems to flash the Preview screen but closes it. Also the form is left
open.
Can this be done in one action?

Gerald

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200612/1


Svetlana
Guest
 
Posts: n/a
#2: Dec 12 '06

re: save/print/close


Instead of DoCmd.Close be specific and write
DoCmd.Close acForm, "NameOfForm"

jaystroup00@gmail.com
Guest
 
Posts: n/a
#3: Dec 13 '06

re: save/print/close


The reason it keeps showing a preview is because your code for
DoCmd.OpenReport has acPreview at the end. I don't remember the exact
option on it, but it will pop up when you go to change it.

Jason



gjameson via AccessMonster.com wrote:
Quote:
I have a form that creates a new ticket. Click save on the form and the form
closes and updates the form underneath. I would like to print a report from
this form when I hit the save button all at the same time.
>
Here is what I have been working with.
>
Private Sub btnAddNewMaint_Click()
Dim stDocName As String
Dim stReportName As String
>
stDocName = "frmCustomer"
stReportName = "rptMaintTicket"
>
MsgBox "Print a copy for tech to printer xxxxxxxx.", vbOKOnly, "Tech
Ticket"
>
DoCmd.OpenReport stReportName, acPreview
DoCmd.Close
>
DoCmd.OpenForm stDocName
'refresh
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
>
End Sub
>
This seems to flash the Preview screen but closes it. Also the form is left
open.
Can this be done in one action?
>
Gerald
>
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200612/1
gjameson via AccessMonster.com
Guest
 
Posts: n/a
#4: Dec 13 '06

re: save/print/close


I do want it to preview. Problem now is that the report does not have the
data entered that was just entered. I guess it has not been written to the db
yet, until it closes. Any other way of doing this?

Gerald

jaystroup00@gmail.com wrote:
Quote:
>The reason it keeps showing a preview is because your code for
>DoCmd.OpenReport has acPreview at the end. I don't remember the exact
>option on it, but it will pop up when you go to change it.
>
>Jason
>
Quote:
>I have a form that creates a new ticket. Click save on the form and the form
>closes and updates the form underneath. I would like to print a report from
>[quoted text clipped - 30 lines]
Quote:
>Message posted via AccessMonster.com
>http://www.accessmonster.com/Uwe/For...ccess/200612/1
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200612/1

gjameson via AccessMonster.com
Guest
 
Posts: n/a
#5: Dec 14 '06

re: save/print/close


I guess this can not be done.

gjameson wrote:
Quote:
>I do want it to preview. Problem now is that the report does not have the
>data entered that was just entered. I guess it has not been written to the db
>yet, until it closes. Any other way of doing this?
>
>Gerald
>
Quote:
>>The reason it keeps showing a preview is because your code for
>>DoCmd.OpenReport has acPreview at the end. I don't remember the exact
>[quoted text clipped - 7 lines]
Quote:
Quote:
>>Message posted via AccessMonster.com
>>http://www.accessmonster.com/Uwe/For...ccess/200612/1
--
Message posted via http://www.accessmonster.com

Closed Thread