Search code examples
formsms-accessreport

How to add blank lines to complete an Access report so that it matches a printed form?


I deal with a bunch of government forms, and I constantly find myself trying to get Access 2013 to output a report that matches a pre-printed form.

Most of the forms are now in .pdf form, so Access doesn't handle them well (to my knowledge) without additional software, which I cannot install on user production computers.

So I usually re-create the form as an Access report, but I have real difficulty when I have only enough records for a half a page.

How do I get a report to print the required records, and then fill the page with blank records so the "form" looks correct?

I'd be willing to try any possible solution - I've even gone so far as to create blank records to try to make this work. My goal, however, is to automate this process so any user can generate the report and it prints out correctly without a bunch of fiddling.

DA Form 1307

On this form, some or all of the lines might be used, and each person (I have ~550 people who each have an individual form) has a different number of lines, depending on the number of jumps they have completed.


Solution

  • I would have a dummy table with just a single numeric field called id. Populate this with a number of records greater than the biggest number of 'extra' records you're ever going to need to fill your form, using numbers from 1 upwards for id. Now say your original record source query for the report is:

    select field1, field2, field3, field4
    from myTable
    order by field1
    

    and you always want 15 rows to fill your form, then change the report's record source to:

    select top 15 sort_seq, field1, field2, field3, field4
    from (
        select 0 as sort_seq, field1, field2, field3, field4
        from myTable
        union
        select id, null, null, null, null
        from dummyTable
    ) as X
    order by sort_seq, field1