Print Preview Destroying subForm References (1 Viewer)

Fran Lombard

Registered User.
Local time
Today, 08:04
Joined
Mar 12, 2014
Messages
123
Im working on building a template form that contains a SubForm which only contains 6 command buttons to act as a standard toolbar to handle standard db actions.
New
Save
Delete
DesignMode
PrintPreview
Close

On initialization of the template form, i pass Me to a a Public Property defined as Access.Form so the my ToolbarSubForm is aware of its parent and has access to its properties.

All works great untill i click the PrintPreview Button.
This Botton invokes the standard
DoCmd.RunCommand acCmdPrintPreview

The command seems run fine.
Template form minimizes and the print preview displays - ok so far so good.

However, upon closing the PrintPreview, the Template Form pops back up. BUT, the SubForms Tookbar variable holding the reference to Parent Form has been destroyed and has list its reference.

Looking for possibly an Event that would fire on the Main Template form after it has popped back up so i can reinialize this variable. Cant seem to locate the appropiate event. Both Form_Activate and Form_GotFocus are firing Pre-PrintPreview.

I basically need a Form_AfterPrintPreview event which doesn't exist .. to the best of mt knowledge.

Any ideas?

Thanks Fean
 

Minty

AWF VIP
Local time
Today, 13:04
Joined
Jul 26, 2013
Messages
7,093
At the risk of missing the point - why are print previewing a form and not a separate report?
Generally, form's don't behave well when printed, and by definition a report does.
 

Fran Lombard

Registered User.
Local time
Today, 08:04
Joined
Mar 12, 2014
Messages
123
Ok heres the logic - may not make sense but it does for me.

Writing reports are a big PITA, and with over a couple hundred tables and writing a report for every table/form would take me forever.

So... I wanted to include a Print button on most every form through this tool bar that envoked some basic functionality. This generally works well on a skinny table with multiple row - like a rule definition.
 

Fran Lombard

Registered User.
Local time
Today, 08:04
Joined
Mar 12, 2014
Messages
123
I found a work-around thats not pretty but works.
The Form_Current event does fire and i now am re-initializing my toolbar an every Form_Current firing.
I wanted to only do this step once - on Form_Load, and the Update the button states on Form_Current only if the data within the current record mandated this action. Now I have to do both for each new record. Doesn't make sense, a lot of extra cycles for nothing.

Still looking for a better solutuin/Approach

Fran
 

Minty

AWF VIP
Local time
Today, 13:04
Joined
Jul 26, 2013
Messages
7,093
Okay - I'll bite ;)

Can you post the code you are using, and have you tried activating the parent object before the print preview?
 

Fran Lombard

Registered User.
Local time
Today, 08:04
Joined
Mar 12, 2014
Messages
123
Okay - I'll bite ;)

Can you post the code you are using, and have you tried activating the parent object before the print preview?
Thanks for the willingness to take a look. I extracted the forms and modules and put them in their own db

I you have any questions let me know - this is all about creating a template to be used as the starting point for other form development.
 

Attachments

Fran Lombard

Registered User.
Local time
Today, 08:04
Joined
Mar 12, 2014
Messages
123
Thanks for the willingness to take a look. I extracted the forms and modules and put them in their own db

I you have any questions let me know - this is all about creating a template to be used as the starting point for other form development.
BTW - FrmTemplate has the work around
frmTemplate_Old is where its broken
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top Bottom