accmdPrintPreview Issue, freezes up screen

joeKra

Registered User.
Local time
Today, 10:59
Joined
Jan 24, 2012
Messages
208
Hello everrybody...

i am experiencing problems trying to print preview my report using Docmd.Runcommand accmdPrintPreview Whenever i am using it bound to a button it will freeze up my screen and i will have to navigate from the dataBase and only after a few minutes it will wake up, does anyone have any suggestion??

Thanks in advance...
 
Last edited:
I am having this report open in report view and i wanna open it in printPreview with a cmdBtn
 
Ok, you have some code in the Format (or Print) Event of one of more of your sections right?
 
Please find attached the data with the report having the problem, the code is placed on the print button,

thank you
 

Attachments

I didn't really ask to see the db. All I wanted to know is if there's code in any of those sections? If there is, please post the code here.
 
sorry...........

Private Sub comdPrint_Click()
Dim CurrentCat As String
CurrentCat = Nz(Me.AssociatedCategory)
Me.FilterOn = True
Me.Filter = "AssociatedCategory = '" & CurrentCat & "'"

DoCmd.RunCommand acCmdPrintPreview

end sub
 
That's fine. Most times we're answering many people and it saves us time if we can see the code here rather than downloading the db. :)

This button resides where? On the report?

Actually the question is, is there any code in the Format event of the Detail section (for example)?
 
No, this is the only code in the report, and the button is placed on the "AssociatedCategory" group header,

Thank you
 
Alright, now I had to download the db. ;)

Do you really want to do this though? When you open the report in Print Preview showing a filtered recordset, how do you switch back to Report View? Or you don't mind this?

Anyway, when you switch between views the report is loaded so any variables declared inside the report will lose their value, i.e. they will go out of scope. So if you want to preserve the value, create that variable in a Standard Module.
 
To be honest - how to switch back unfiltered, this will be my next question, :)

the reason i need to open it in preview instead of printing is because if it will have no default printer it will result in error, so if you could provide me a reasonable way how to set a default printer from access you could drop the hack... But i still think its good to get over the bug without using alternative
 
You will need to create a button on the ribbon to do this. Or create a Context menu. Print Preview doesn't have any interactivity which was one of the reasons why Report View was introduced.

It's not a hack, it's just the way it goes. Declare the variable in a Standard Module and not in the report module.

For changing the printer settings, this should be a good start:

http://msdn.microsoft.com/en-us/library/aa139946(v=office.10).aspx
 
Bottom line... do you have a way out from the freeze up problem, so i should be able to use the command down the road...
 
It doesn't freeze on my end so there's something else wrong. Perhaps you have a timer somewhere.
 
Oh my......

let me ask you another question, in theory , may i edit the vba code while the form is open in report view or i have to switch to design \ layout view, the reason i am asking is because i am used to irregular behavior i suspecting that this is the cause,
while typing...... i think it might be a problem with my Access, because the same DB worked on your computer, does it make sense?
 
You can but it is only logical to do it in design view. Also, you need to Compile regularly so this is one reason why you should code in Design View. Have you compiled since?

What are the exact steps to reproduce the problem?
 
should earn $10 dollar for every time i compile..... last time was 20 min. ago, furthermore, the problem persist in the fresh new dataBase i attached too, any suggestion?
 
No attachment. But I also need to know EXACTLY what you do to encounter this problem?

And is this database shared?
 
The back-end is shared,

i cant determine what i am doing to encounter problems,

the attachment i were referring to, is the one i did attached and you had download which you told me that by you is it working perfectly, so my question is is it possible that my Access program is corrupted?
 
Yes, it may be working perfectly but my steps may be different from yours.

Anyway, if the BE is shared and you are connected to it, you shouldn't be doing any Design Changes. Disconnect from the BE or make a copy local and connect to the local copy. That's the problem.
 

Users who are viewing this thread

Back
Top Bottom