Connecting Tech Pros Worldwide Help | Site Map

save/print/close

 
LinkBack Thread Tools Search this Thread
  #1  
Old December 12th, 2006, 01:55 PM
gjameson via AccessMonster.com
Guest
 
Posts: n/a
Default save/print/close

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


  #2  
Old December 12th, 2006, 04:15 PM
Svetlana
Guest
 
Posts: n/a
Default Re: save/print/close

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

  #3  
Old December 13th, 2006, 03:25 AM
jaystroup00@gmail.com
Guest
 
Posts: n/a
Default 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
  #4  
Old December 13th, 2006, 11:55 AM
gjameson via AccessMonster.com
Guest
 
Posts: n/a
Default 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

  #5  
Old December 14th, 2006, 09:29 PM
gjameson via AccessMonster.com
Guest
 
Posts: n/a
Default 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

 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,840 network members.