472,789 Members | 1,163 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Printing options from Command Button

114 100+
Hello,

I am using MS Access 2002-2003. I added a "Print Record" command button to a form in my database. Is there a way (via VBA or anything else) to open a print preview screen when the command button is selected instead of immediately printing the record?

Thank you!

Martin DH
Mar 6 '07 #1
5 8354
ADezii
8,834 Expert 8TB
Hello,

I am using MS Access 2002-2003. I added a "Print Record" command button to a form in my database. Is there a way (via VBA or anything else) to open a print preview screen when the command button is selected instead of immediately printing the record?

Thank you!

Martin DH
Print Preview was designed primarily as the View Argument to the OpenReport() Method. From my knowledge, it was not intened to be utilized for individual Record printing. The following code will, however, work but probably not with the intended result. It is simply out of context. Try it and see:
Expand|Select|Wrap|Line Numbers
  1. DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
  2. DoCmd.RunCommand acCmdPrintPreview
Mar 6 '07 #2
MMcCarthy
14,534 Expert Mod 8TB
Assuming the current code is ...

Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenReport "Report Name", , , [WhereCondition]
Change it to ...
Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenReport "Report Name", acViewPreview, , [WhereCondition]
Mar 6 '07 #3
ADezii
8,834 Expert 8TB
Assuming the current code is ...

Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenReport "Report Name", , , [WhereCondition]
Change it to ...
Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenReport "Report Name", acViewPreview, , [WhereCondition]
Hello Mary:
I was under the assumption that the OP was printing a Record from Form View. Is my interpretation wrong?
Mar 6 '07 #4
MMcCarthy
14,534 Expert Mod 8TB
Hello Mary:
I was under the assumption that the OP was printing a Record from Form View. Is my interpretation wrong?
I wasn't sure from the question so offered the alternative solution. I'm sure we'll find out eventually.

Mary
Mar 6 '07 #5
martin DH
114 100+
I wasn't sure from the question so offered the alternative solution. I'm sure we'll find out eventually.

Mary

Yes, I am working in the form view. Below is the code from the print record command as is. The DoCmd.RunCommand acCmdPrintPreview code brings up a print preview of all the records, not just the selected record. I appreciate the help!

Expand|Select|Wrap|Line Numbers
  1. Private Sub Print_File_Click()
  2. On Error GoTo Err_Print_File_Click
  3.  
  4.     DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
  5.     DoCmd.PrintOut acSelection
  6.  
  7. Exit_Print_File_Click:
  8.     Exit Sub
  9.  
  10. Err_Print_File_Click:
  11.     MsgBox Err.Description
  12.     Resume Exit_Print_File_Click
  13.  
  14. End Sub
Mar 8 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Darcy Kahle | last post by:
I am trying to do some advanced printing in python using the win32ui module, and have run into an issue. I need to print a page landscape. As I could not determine how to specify the orientation...
4
by: Marina Ferguson | last post by:
Hi, I have a document with an iframe. The main doc has a "Print" button. The idea is that when the user clicks it, the contents of the iframe is printed. For some reason instead of the iframe...
15
by: TJ Walls | last post by:
Hello All, Is it possible to create a <select> element with no selected options? I have tried setting the selectedIndex attribute to -1, but as far as I can tell this only works for <select...
9
by: Tony Williams | last post by:
I have an Access database that we use as a document index system. The documents can be Word, Excel, pdf's etc I have a command button on a form that opens the document in whatever program is...
5
by: Stefania Scott | last post by:
I am trying to print a word document from Access. The code I've written works well in my computer but does not in the one were it is needed. Here the piece of code: 'doc path strObjectPath =...
1
by: Dreamtime | last post by:
Hi I am using Visual Studio 2005 and the bundled Crystal Reports (previously I used .net 2003 and bundled Crystal Reports for 2 years - same issues!) I have a report which is displayed in the...
1
by: Stinky Pete | last post by:
Hi, I've been reading, and successfully tested some code referred to in this group, that allows a user to select a printer before printing a report. The code has worked well on single page...
3
by: Richard MSL | last post by:
I have an application that prints documents that it creates. It uses what I believe is a standard .NET way of doing so, like this: PrintDocument pd = new PrintDocument(); pd.PrintPage += new...
2
by: deepakfordotnet | last post by:
Hi, First of all let me confess that I could not get the solution to the same problem from an earlier post Printing :by Mr.Richard MSL (dated September 24th 2006) working. (Replied by Mr.Walter...
0
by: Rina0 | last post by:
Cybersecurity engineering is a specialized field that focuses on the design, development, and implementation of systems, processes, and technologies that protect against cyber threats and...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.