Added on: Wednesday 17th March 2010
The problem is that often although the form is displaying one record it will actually print out all the records in the underlying recordsource which can mean the whole table.
I did a quick search on the Internet and was surprised to find that almost all results suggest creating a report and then using the 'where condition' of the OpenReport method so that only the selected record is displayed.
The question is- is it worth creating a report for every form that you might want to print out.
I was surprised that not one solution mentioned actually printing the form itself.
All you need to do is use the PrintOut method and ensure that it only prints one page. The code behind the button is shown below:
DoCmd.PrintOut acSelection, 1, 1
Where acSelection is the print range and the two 1s are the first and last page to print.
There are other tricks you can use too. All objects on the form have a Display When property - by default this is set to Always but if you set it to Screen Only the object won't appear on the printed page. So for example your print button doesn't need to appear on the print.
The header and footer sections of the form also have a Display When property so you can hide these too on the print out.
Finally, you can change the Page Setup for the Form - for example changing the layout to Landscape and reducing the margins - so that the record fits on one page.
There are disadvantages of course - you'll get all the shading or colour of the form - but as a quick and dirty method it works fine and saves building a report.
Andrew Parrott runs Round Ash Associates, a web design and development company based in Chagford on Dartmoor, Devon.
If you prefer updates via email then please enter your email address below and click Submit.
If you haven't been to Chagford before then take a look a what you are missing.
Sitepoint is an indespensible resource for web designers.
Internet Explorer isn't the only web browser and from a development point of view Firefox is much better.
As many of the articles on this site are slightly techy I thought I ought to link to a glossary of Internet terms.
The layout for this site uses one of Matthew James Taylors 'liquid layouts'.
©Round Ash Associates 2009. Powered by form2list.