Create button on form that prints to report (1 Viewer)

Pluribus

New member
Local time
Today, 08:16
Joined
Dec 6, 2010
Messages
3
Hi

I am very new to access and am not getting on with it very well...

I have created a table, form and a report. On my form is a button. When I press that button, I would like to print the current on screen record only using a report I also built. I have looked through various help threads and its all a bit over my head.

My table is called "Firearm Sales Table"
The table has the following fields:
"ID" (auto generated by access)
"Name"
"Date"
"Address"
"Address 2"
"Town"
"County"
"Post Code"
"Certificate Number"
"Type"
"Firearm" (checkbox)
"Shotgun" (checkbox)
"Sale" (checkbox)
"Acquisition" (checkbox)
"Calibre"
"Make"
"Model"
"Serial Number"
"Sold By"
"Date Faxed (if known)"

My form, "Firearms Sales Form", has the same fields with the exception of the ID field.

My report, "Firearm Sales Report", is set up with the same fields - again with the exception of the ID field.

On my form I have placed a button called "Print Record".

In a perfect world this will happen:

User enters data onto the "Firearm Sales Form" form. User clicks Print Record button and the "Firearm Sales Report" opens with the current on screen data only and prints automatically. I only want that record to print.

I have tried many different answers from various threads, here and on other forums, but each time the most I can do is get the button to print the entire report consisting of thousands of records...

Can anyone help? I am using Access 2010 and would appreciate easy to understand step by step answers please!

Sorry for the long post!

Thanks

Ian
 

Trevor G

Registered User.
Local time
Today, 16:16
Joined
Oct 1, 2009
Messages
2,341
Ian welcome to the forum,

If you want only the record from the form to be shown on your report follow these steps in creating a macro.

Select Create Tab
Select New MACRO
In the first Action select OpenReport, in the action argument below do this

Select your report name
Select Print = Print Preview


In the where conditions arguments below do this
Click in the line then select the elipsees button on the right, then from the expression builder find your table and then double click the ID field add an equal sign = then double click the forms and find your form then double click the ID field so it will show you something like this

tblNameProductID=fromNameProductID

Then save the MACRO something like mcrPreviewProductRecord

Now open the form in design view then show the Navigation pane find the MACRO and drag onto the form (it will create a button for you). Save the form and change the view, once you select a record then click the button it will preview your record in the report.
 

Pluribus

New member
Local time
Today, 08:16
Joined
Dec 6, 2010
Messages
3
Hi Trevor

That was absolutely spon on perfect. Works exactly the way I want it to!

Many thanks for your help (and to everyone else too)

Ian
 

Trevor G

Registered User.
Local time
Today, 16:16
Joined
Oct 1, 2009
Messages
2,341
Ian,

Pleased to read this is want you want and you have it working in the way you want it to.
 

Users who are viewing this thread

Top Bottom