Easy for some!

Bradon

Board Regular
Joined
Dec 18, 2002
Messages
66
As a newbie to access I have to create a command button that will send the data on a page to a report shell and print just that one record as a report.

Where do I start?
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Create your report and save it. Then, with the control wizard toggle depressed, draw a command button on your form, choose the open report action and give it the name of your report.
 
Upvote 0
Thanks Mudface,

The answer is always simple when you know how! Thanks again and good to see the English flag - beats a star circle any day.....
 
Upvote 0
Thought things were going too well!

I created the button using the method described and it shows the report layout I want but shows reports for all pages.

What I want to show is just the page that is relevant to the window open in the form at the time the button is pressed.

Any suggestions?
 
Upvote 0
The code to open a report also takes a WHERE parameter, set this to equal the current record on your form. This would look something like-

DoCmd.OpenReport "rptName", acViewPreview, wherecondition:="[uniquefield] = " & Forms!frmName!uniquefield

or, if your primary key is a string-

DoCmd.OpenReport "rptName", acViewPreview, wherecondition:="[uniquefield] = '" & Forms!frmName!uniquefield & "'"

Replace the various bits with as appropriate.
 
Upvote 0

Forum statistics

Threads
1,221,573
Messages
6,160,595
Members
451,657
Latest member
Ang24

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top