Printing form repaint

matt beamish

Registered User.
Local time
Today, 23:33
Joined
Sep 21, 2000
Messages
215
I have a complicated form which is actually a letter, that I need to print out to pdf. There are a load of visibility controls that I have put in the forms "On Current" event. If I view the form on screen it is good. If I print as a multi page PDF, the form is not repainting correctly between each record. My onCurrent events VBA ends with

me.repaint
End Sub

I have tried converting to a report, but I really do not want to rewrite all the VBA.

Any clues?

thanks
 
Rather than send the Form to a PDF, why not create a Report that replicates the look and feel of your form and send that to a PDF? After all that is what reports are designed for.
 
because I'd have to rewrite all the VBA - wouldn't I??
 
Your other option is to step through your Record Set and print each record individually.
 
And I can't programmatically print with a delay between each page that gave a second or two for the repaint?
thanks for responses
 
The On Current event will only fire on the record that holds focus.

Also when you print a form it will print the form for all records in the record set.

From Here
Note When you print a form, even though you might be viewing only a single record, Access prints all the records for the record source for the form. If you want to print only specific records, apply a filter to the form before continuing. For more information about filtering, see the article Filter: Limit the number of records in a view.

So what you will need to do is create a loop to filter the records you need to print, and cycle through them one by one.
 
OK, so I rewrote the form as a report, and rewrote the VBA behind it. I then set the thing to print to pdf. Two problems.
1. The line break that I put in the footer (just as in the form) was ignored so all the report was one long stream.
2. The visibility commands that are listed in the VBA and are dependent on bound and unbound controls on the report were obeyed on the first report, but disregarded for the next 314.

So I had to abandon the report and go back to my form. To get what I needed I had to page through the form, printing each page to pdf as a separate file with customfile name. It took me c. 5 hours for 315 of them, and I really don't want ever to have to do it again.
 
In the report you should be able to set the "force new page" to either start the next record on the next page or start the current record on a new page.
You can find the setting if you go into design mode on your report.
Open the properties for the report and use the dropdown in the properties window to select "detail" or click on the details bar in your report.
In the format section of the properties window you can the force new page setting.
 
Thanks Anarkadian,
done that and it works. Ill try to remember that one, and not to use "Insert Page Break" in the footer. Just to sort the VBA visibility issues now.
M
 

Users who are viewing this thread

Back
Top Bottom