[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 670
  • Last Modified:

Create a marco within a form button that will use the item number to print the record that is on the screen

Create a marco within a form button that will use the item number to print the record that is on the screenCreate a marco within a form button that will use the item number to print the record that is on the screen.
0
frank_guess
Asked:
frank_guess
  • 3
  • 2
1 Solution
 
SteveCommented:
Can we have some form of Sample workbook as a starting point.
It would be very easy to create something that is not related to your requirements.
0
 
hnasrCommented:
In VBA:
' this code prints a current record displayed in form
Report name: Contract
Form's control for contractID: contractID, [item Number] in your question.
RecordSource field name: ContractID

Private Sub btnPrintCurrent_Click()
    DoCmd.OpenReport "Contract", acViewPreview, , "[ContractID] = '" & Me!contractID & "'"
End Sub
0
 
hnasrCommented:
Macro: Macro1, forms' name:Contract, Button click event set to Macro1.
Create macro: select relevant entries.

Report Name: Contract
               view: Print Preview
Where Condition=     [Contracts]![contractID]  =[Forms]![Contract]![contractID]
0
Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

 
frank_guessAuthor Commented:
I have a form that has a print button on the form, this is utilizing the automated feature of button creation (using the wizard).  I have two key fields one is called item number and one called Evidence bag number.
I need to print the Chain of custody form with the form that I am setting on.
So I need to know how to make the most of how to control single record printing.  I have a query where presently I can type in the Item number and it will print the information that is on the form.  But it brings up the printer screen and goes through all the stuff for printing.  What I need it to do is print the single record that I am setting on and not go through the entire process.  Got any ideals how to make the macro work correctly.
0
 
frank_guessAuthor Commented:
The print button has the on click with the following macro:
Action - OpenReport
Arguments
RPT_Single_Evidence_Tracker_Rpt, Print Review, , , Normal
RunCommand
Print

How do I change this macro so it will fill in the item number from the item number on the form.
0
 
hnasrCommented:
Looks like a different version from 2010

Try changing the click event to [Procedure]
and add the following to the button click procedure

DoCmd.OpenReport "Contract", acViewPreview, , "[ContractID] = '" & Me!contractID & "'"

Open in new window

Modify
Report Name: Contract  to "RPT_Single_Evidence_Tracker_Rpt"
Table field name: [ContractID] to your [Item Number]
Control name on form: contractID  to respective control name on your form
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now