473,799 Members | 2,734 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 = "frmCustome r"
stReportName = "rptMaintTicket "

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

DoCmd.OpenRepor t stReportName, acPreview
DoCmd.Close

DoCmd.OpenForm stDocName
'refresh
DoCmd.DoMenuIte m 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.c om
http://www.accessmonster.com/Uwe/For...ccess/200612/1

Dec 12 '06 #1
4 1254
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.OpenRepor t 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.c om 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 = "frmCustome r"
stReportName = "rptMaintTicket "

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

DoCmd.OpenRepor t stReportName, acPreview
DoCmd.Close

DoCmd.OpenForm stDocName
'refresh
DoCmd.DoMenuIte m 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.c om
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*********@gma il.com wrote:
>The reason it keeps showing a preview is because your code for
DoCmd.OpenRepo rt 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.c om
http://www.accessmonster.com/Uwe/For...ccess/200612/1
--
Message posted via AccessMonster.c om
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.OpenRep ort has acPreview at the end. I don't remember the exact
[quoted text clipped - 7 lines]
>>Message posted via AccessMonster.c om
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
34181
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 the relevant infomation, in a binary format. SQL Enterprise manager offers no way to script out those diagrams, so I have created two Transact SQL components, one User Function and one User Procedure, which together provide a means to script...
5
7975
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 fso=server.createObject("scripting.filesystemobject") set ctext=fso.createtextfile("c:\mydata.txt",true) ctext.close set ctext=nothing set fso=nothing
5
7410
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 or save output?
3
6129
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 want to write: <html> <body>
5
3104
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 to a file after reading it from a http connection. Thank you.
5
3401
by: peter | last post by:
Hello all, I'm looking for an advice. Example (one block in ascii file): $------------------------ NAME='ALFA' CODE='x' $------------------------
12
4779
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 on the client's computer? He/she could do this using the browser (file/save), but I need to have it done by pressing the pushbutton. In my serverside code I get the button-click-event, I also know how to get
5
2220
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)) saves.append(str(exp)) saves.append(str(maxexp)) saves.append(str(gp))
0
9543
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10488
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10237
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9077
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7567
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5588
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4144
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3761
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2941
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.