VBA Print 5 Copies Of Report Via Button On The Form
Nov 1, 2011I am trying to print 5 copies of the report via the button on the form.
I'm sure I have the code correct, however I only prints 1 copy instead of 5.
I am trying to print 5 copies of the report via the button on the form.
I'm sure I have the code correct, however I only prints 1 copy instead of 5.
In Access 2007 is it possible to alter a macro so I can print 2 copies of a report. I have created a simple macro which opens up a report based on a value in a data entry form. I want to automatically print 2 copies of the report. Is this possible....
View 1 Replies View Related Im using a button to print a report based on a text box values on the form.the code for which is below
Code:
Private Sub SaveBtn_Click()
DoCmd.SetWarnings False
DoCmd.RunSQL "Update BookInTable SET DateBookedOut = '" & Me!DateTxt & "' WHERE BarCode ='" & Me![BarTxt] & "'"
DoCmd.RunSQL "Update BookInTable SET BookedOut = True WHERE BarCode ='" & Me![BarTxt] & "'"
DoCmd.OpenReport "Labels", acViewNormal
DoCmd.PrintOut , , , , 1
DoCmd.Close acReport, "Labels", acSaveNo
DoCmd.SetWarnings True
End Sub
The problem that I am getting is not only is the label printing but so is the form.
I have a project which produces a report of names, addresses, etc. I added a print button to the form to send the report to the printer. The code is as follows:
Private Sub Command32_Click()
Docmd.SetWarnings False
'Docmd.OpenReport "rptAddresses", acViewNormal
Docmd.RunCommand acCmdPrint
Docmd.SetWarnings True
End Sub
Both alternatives in the code produce the same result described following.However, the printed report includes only the first 2 colums of about 10 of the 90 plus records. If I send to to a PDF, it works fine. If I do a print view on the screen ir looks fine.
I have VBA code for a Print Preview button on the main form that previews the current record in a separate Report using this code:
Code:
Private Sub cmdPrintRecord_Click()
Dim strWhere As String
If Me.Dirty Then 'Save any edits.
Me.Dirty = False
End If
[code]....
I use this Print Preview code on a Button in the Form Header. The Main form lists head of household information. I also have a tabbed control with three tabs that have SubForms for Address, Children and Contact details. The problem I have is that if any of the subforms are left blank I get a Run-Time Error '3021': No Current Record. If I Debug (press the button), it takes me straight to this line:
Code:
varAge = DateDiff("yyyy", varBirthDate, Now)
highlighted in Yellow.Anyone on my database must have an address, should have contact details and could have children. If any one of these is blank then the print preview will not work.I would like to know how to stop this error happening for blank records in my subforms.
I have a form in Access with a command button that prints a receipt (which is actually created as a report). Anyway, I want 2 copies of this receipt to print when the print receipt button is clicked. Please take a look at my code and tell me what I would need to be able to accomplish this. Thanks.
rivate Sub PrintRec_Click()
On Error GoTo Err_PrintRec_Click
Dim rstTrans As New ADODB.Recordset
Dim fld As ADODB.Field
Dim strField As String
Dim curCount As Currency
rstTrans.Open "dbo_tbl_Transactions", CurrentProject.Connection, adOpenKeyset, adLockOptimistic
If IsNull(Me.TempTransNumID.value) Then
'this is new record
rstTrans.AddNew
Else
'to stay on the record that was just inserted for editing
rstTrans.Find ("TransNumID=" + Str$(Me.TempTransNumID))
End If
rstTrans!TransDate = Me.TransDate
rstTrans!CustomerName = Me.CustomerName
rstTrans!VehType = Me.VehType
rstTrans!TktType = Me.TktType
rstTrans!Auth_By = Me.AuthBy
rstTrans!Quantity = Me.Quantity
rstTrans!SHtkt1 = Me.SHtkt1
rstTrans!SHtkt2 = Me.SHtkt2
rstTrans!HRtkt1 = Me.HRtkt1
rstTrans!HRtkt2 = Me.HRtkt2
rstTrans!TransPayAmt = Me.TransPayAmt
rstTrans!PaymentType = Me.txtPaymentType
rstTrans!PaymentMethod = Me.cboPaymentMethod
rstTrans!CheckNum = Me.CheckNum
rstTrans!TransReceiptMemo = Me.TransReceiptMemo
rstTrans!TransEntryTime = Now()
rstTrans!TransEntryUserID = appUser
If Me.cboPaymentMethod = "Check" And IsNull(CheckNum) Then 'Check number not entered
MsgBox "You must enter a check no.", vbCritical, "Check Number Verification"
CheckNum.SetFocus
Exit Sub
End If
rstTrans.Update
'this was a new record so update the form value of TransNumID for edit
If IsNull(rstTrans!TransNumID.value) <> True Then
Me.TempTransNumID = rstTrans!TransNumID.value
End If
whereClause = "NewQryShuttleHandiRideReceipt.TransNumID" & " = " & rstTrans!TransNumID
//////here is where I'm printing the receipt
DoCmd.OpenReport "RptShuttle HandiRide Receipt", acViewNormal, , whereClause
rstTrans.Close
Set rstTrans = Nothing
Me.cmdAddRec.Enabled = True
Exit_PrintRec_Click:
MsgBox "Record Successfully Saved! Printing Receipt."
Exit Sub
Err_PrintRec_Click:
MsgBox Err.Description
Resume Exit_PrintRec_Click
End Sub
I want to print 3 copies of a report named Invoice with different remark i.e. Customer Copy, Office Copy, Auditor Copy. I want to print all 3 copies with a single print command.
Can any one help me.
Sample database is in attachmant.
Hello everyone,
How can i have a form with a "Print" button on it for print a report instead of going to file, print?
I will appreciate if a sample of such database can also be attached.
Stay well.
I have an old access database (written with 2003 but running under 2010) that creates workorders and I need to change a couple of the reports to print three copies with each copy having different text in the footer. I'm converting the reports from a old DOT Metrix special form printer to a laser printer. I have already modified the reports as far as the titleing and cosmetics are concerned and they print and look great on the laser printer. I have also added a TxT box that I want to contain the information on the report.
The reports are generated in a couple of different ways off different screens in the system off buttons, but I figured if I can get one of them to work I can replicate it to the others.
I have gone through the reports forum and have found a couple of solutions but can't get them to work. This is what I have found:
On the on button to print a range of workorders (it drives a query that asks for a starting workorder number and a ending workorder number) click from the from the switchboard:
DoCmd.OpenReport "rptBulkWorkOrdersbyWorkOrderNumberRange", , , , , "1"
DoCmd.OpenReport "rptBulkWorkOrdersbyWorkOrderNumberRange", , , , , "2"
DoCmd.OpenReport "rptBulkWorkOrdersbyWorkOrderNumberRange", , , , , "3"
Then I have this code but I'm not sure where it goes. On the report in the "on open" expression? not sure..
Select Case Me.OpenArgs
Case "1"
txtBox62 = "Shop Copy"
txtFld1 = [qryField1]
[Code] .....
A command button on a form that can:
1- Open the Report called : ConsentForm
2- Print it to PDF printer (report is currently defaulted to that printer driver)
3- Save to folder: C:SOSConsentForms
4- Save as: Consent_[Last]_[First] (these are field names on the form)
Result i.e.: C:SOSConsentFormsConsent_Doe_John
5- Then send the file by email (Outlook) to : abc@hotmail.com
I have a database with several reports that get constantly printed, however I am having an issue with their display properties that sometimes cause errors.I need the report to come up on top of everything, maximized and with the menu bar available to allow for it to be printed or close it. The report window cannot have "minimize" or "restore" available to make sure nobody access any form behind it.
To achieve this in a form I generally use the modal property, however if I do this in a report I cannot get to the menu bar to print or close the print preview.Thinking that modal was out of the question, I went ahead and maximized the report on load and set its properties to the image attached. The db is then compiled (accde) and then distributed.
On my computer (it is being developed on my machine) the report loads fine (maximized) with no min, max or restore buttons and the print preview menu bar is shown with the print and close buttons available. See "My PC" image attached.On any other computer, the report opens up maximized but the report's restore and close buttons are enabled, however the print and close buttons on the print preview menu bar are greyed out. See "Other PC" image attached.Why the inconsistent behaviour when using the same front end?
I added a "print preview" button to a report that does just that, shows the print preview. The issue I'm having is that I can't do anything in Access after I click that button. Everything in Access seems to stop working, I can't click on anything with my mouse. the only thing that does anything is that i can move the report up and down with the up/down/left/right keys. If I click on a different application that isn't Access (i.e. excel, spotify, email, etc.) and then go back to it, everything works fine.
View 4 Replies View RelatedI have an unbound form with an associated report. When the user hits the 'print' button on the form/screen, the report is launched in the background. In the On Load event of the report I populate the report fields from the forms field as so:
Code:
Me.txtAddrMainLine2 = "NAME " & UCase([Forms]![frm_OrderRx].[txtPatientName])
This works like a charm as long as I call the report in Print Preview mode (i.e. with acViewPreview). But if I send the report directly to the printer, none of the fields print.
I've read about using other report events to populate the fields (e.g., On Format and On Print) and also something about using TempVars to pass the data. But I haven't read anything that's clear and definitive about the full answer.
I am working with an already intact database along with a form. One of the buttions in the form, when pressed, prints two copies of a P.O. One copy says original on the bottom and the other says PX Copy and my boss wants the PX Copy to stop printing. How do I get it to stop?
View 3 Replies View RelatedHi... being extremely new to Access, i am sitting here frustrated as anything trying to make this work. I will attempt to explain what I am trying to do.
I have a form that has a combo box in it. This combo box references a table and pulls in the data depending on the company that is selected. What I am trying to do is add a print button on the form, so that the users can print off an address label. Now I can use the normal print report feature and this prints of the entire report, but what i would really like is the print button just to print the fields I want and not the whole thing. The fields I want to print are.
Name_1
Delievery_Address_1
Delievery_Address_2
Delievery_Address_3
Postcode
Ive had a look in the event field for the print button, but I have no idea of the commands to make it only select the fields that I want to print.
I truly am lost, and seeking guidance from the masters here at Access World.
My printing problem is in your hands.... cheers Paull
I would like to add a button to a form that will print the form with the current record in it. Also, to add a level of difficulty, there are 8 subforms attached to the form. As I already have the form developed, I don't want to reinvent the wheel and go off and create a report with 8 subreports. Is this possible? If so, Can we force all the data on the form to one page?
View 1 Replies View RelatedUsing Access 2010.I purposely disabled the Access Objects when opening my database for added security. This works.
The problem I'm having is when I use the print button (access macro) on one of my forms, as soon as i click the button, the "all access objects" window opens on the left side navigation. This window shows all of my tables, forms, queires..etc.Is there a setting that will permanately stop this from opening?
In Access I have created a button to print a preview prior to printing document it is entitle "NoVeteranMain" which works fine. Except I want it to save my document prior to printing preview how would I do it. If not after I edit it I have to re-save it prior to hitting button which generates print preview.
This is code that is generate upon click
Private Sub NoVet_Click()
DoCmd.OpenReport "NoVeteranMain", acViewPreview, , "ClientID = " & Me.ClientID
End Sub
I have a form which records the progress of a complaint investigation. There are 3 reports I would like to run from this form using command buttons. They are report_long (shows all activity) report_short (summary) and logsheet.
The primary key is complt#.
How do I ensure that the complaint being printed is the complt# I have on the form?
Please bear with my ramblings, but I’m not sure what you may find relevant.
I am currently doing work for a service company where the employees are required to wear the company’s uniform. When someone joins the company they are required to purchase their own uniform. After a year, the company buys the replacement uniform. Each year on the anniversary date, the employee is given their annual evaluation. At that time they are given a requisition to go to the uniform supplier for new uniform articles.
Each item in the uniform has a life span. For example, shirts and pants are replaced each year, winter coats and spring/fall coats are replaced every three years, caps every two years etc.
I have a form which lists the item no., description and cost of each item and when they are due to be replaced. For example
Winter coat last replaced on 2003/11/10, replacement date is calculated to 2006/11/10
When this employee has his evaluation this November, he will be entitled to a new winter coat. The calculations are done by clicking an option button beside the item on the form. Clicking replaces the issue date with Date() and adds three years to the issue date using DateAdd for a new replacement date. Clicking the button also indicates that the item is to be replaced.
NOW, I have all this working.
What I would like to do is find some way of printing the requisition from this form before closing it. Something along the lines of:
If Option1 is yes
Print this item on the requisition
Endif
And do this on every item on the form, if it’s yes, print it on the requisition, if its no ignore it.
The option buttons are not part of the underlying tables or query only part of the form.
If I’m doing this backwards, please let me know. I’m well ahead of my deadline.
I have a form and the information on the form is displayed in a report so the user can print it out.
I have placed a command button on the form so that when you press the button you can print the report.
I was wondering if there was a way how i could just get it to print of the specific page i was on at the time.
Thanks for any help
My report produces multiple copies of the same record. I know why, but don't know how to fix it.
EmployeeTable.
With a one to many relationship with TrainingTable (via employee PK as FK in trainingtable).
Training table has a one to many relationship with a table called Range.
Report is based on a query that picks up the Employee/Training/Range (range just describes the training unit).
However, If I have more than one range expressed organized a training unit, the report spits out several copies of the Employee record to display all the ranges.
I have a button on a FORM to print the current record with the following code:
DoCmd.RunCommand acCmdSelectRecord
DoCmd.PrintOut acSelection
But what I need is that before printing, open the preview to set the margins and page size ... or at least to pre-configure so that when you press the button, and comes preformatted.
Hello,
I have a time and billing database that contains a form where the user enters a beginning date and an end date and then must enter an invoice number. All this information will appear in the header of a report. The invoice number will always be different. How can I get the invoice number to print on the report? The beginning and ending date is working just fine, but I can't get the invoice number to print. I think I need to have whatever number is entered to be temporarily stored to a table, but I am not sure at all. I would appreciate any help given.
Thanks.
I have a patient information database which uses a filtered form to show records for only one patient at a time. All the records in the database are linked together using one number, the patient's unique identifier.
I have designed a report which draws information from separate tables and generates a complete summary of information. This report depends on having the ID number of the patient to generate the report.
Originally, I had envisioned having a command button on the data entry form, which would then automatically take the ID number from the form, and generate the report. Though good in theory, it never worked out in practice, as I could never figure out how to make it happen.
Is there a way to design a macro or some other thing that would take the ID number from the field on the form, and use it to generate the report? Currently, I have it configured to prompt me for the ID number. When I enter it manually, the report is generated perfectly.
Thank you in advance,
I am trying to print from a form to a report. The problem I am running into is I am getting a long report and I have discovered I have basically the same number of pages in my report as I have entries in my subform. If I have one entry in my subform I get a 1 page report. If I have 2 entries in my subform, I get 2 pages in my report and they look exactly the same. What am I doing wrong?
View 2 Replies View Related