473,386 Members | 1,757 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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

Dec 12 '06 #1
4 1238
Instead of DoCmd.Close be specific and write
DoCmd.Close acForm, "NameOfForm"

Dec 12 '06 #2
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:
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
Dec 13 '06 #3
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

ja*********@gmail.com wrote:
>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
>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]
>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

Dec 13 '06 #4
I guess this can not be done.

gjameson wrote:
>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
>>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]
>>Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200612/1
--
Message posted via http://www.accessmonster.com

Dec 14 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Clay Beatty | last post by:
When you create database diagrams in Enterprise Manager, the details for constructing those diagrams is saved into the dtproperties table. This table includes an image field which contains most of...
5
by: Rajani | last post by:
How can i save the textarea(retrieved from DB) data to client system as a textfile. I am using filesystemobject to create a text file with the path set...
5
by: Poster | last post by:
I have a script, its outputs are in HTML. It displays perferctly in a browser, however when I view source, it gives me the JS scripts, but I want to view the HTML output. Is there a way I can view...
3
by: needin4mation | last post by:
Hi, I have access 97. I can upgrade if I have to (but that will cost more money :)). If I want to read a row, parse that row, and then save the values to an HTML file, will VBA do that? Say I...
5
by: yinglcs | last post by:
Hi, I am new to python. I read an example here about how to fetch data thru a HTTP connection: http://diveintopython.org/http_web_services/review.html, My question is how can i save the data...
5
by: peter | last post by:
Hello all, I'm looking for an advice. Example (one block in ascii file): $------------------------ NAME='ALFA' CODE='x' $------------------------
12
by: =?Utf-8?B?RnJlZU5FYXN5?= | last post by:
Hello, the scenario: There's an ASPX page which shows some text and has three buttons at the bottom: Save, Print and Close. Print and close is done by javascript. But how can I save the page...
5
by: xZaft | last post by:
def save(): try: saves.append(str(level)) saves.append(str(stre)) saves.append(str(spd)) saves.append(str(hp)) saves.append(str(maxhp)) ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.