report print preview code awry

I have a form on which is a button to click to bring up a report from which I'd like the user to be able to print the report.  The code I have on the button is as follows:

Private Sub Command40_Click()

DoCmd.OpenReport "DA2062_New", acPreview, "[ID] = " & Me![ID]
End Sub

What I'm getting is that the report does open in print preview mode, BUT, first, it opens up beneath all my other open forms as opposed to right on top, so with the other forms which are open at the time a user may not even realize the report even opened, and second, the actual print button in the print preview menu bar is greyed out and doesn't let the user actually click it to print the form.  Can somebody please help me correct this code to do as it should.  Thanks.
JARichardHIAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
Try this:

DoCmd.OpenReport "DA2062_New", acPreview, "[ID] = " & Me![ID],,acDialog

mx
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
JARichardHIAuthor Commented:
Okay, I think adding the acDialog helped, but with two issues.  With it at the end where you have it, the report does open up above everything else now, which is great, but it no longer opens to the actual record open in the form anymore and the Access menu bar doesn't change to the print preview options at all. If I place the acDialog after the acPreview, as in acPreview, acDialog, "[ID]" ect... then the proper record is loaded into the report, the menu bar switches to print preview options with the print option no longer grayed out, BUT the report goes back to opening up beneath everything else.
0
Rey Obrero (Capricorn1)Commented:

the where clause is off by one position, try this

DoCmd.OpenReport "DA2062_New", acviewPreview, , "[ID] = " & Me![ID], acdialog
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
Well, you can't change the position of acDialog.  And not sure why it's not opening to correct place.

mx
0
JARichardHIAuthor Commented:
Thank you Capricorn, that corrected the issue with the records opening up, but now would you know why the Top Access Menu isn't changing to the print preview options with the print button and all that?  Is it even supposed to, was it just a fluke that it was doing it before?
0
Rey Obrero (Capricorn1)Commented:
it might be due to the acdialog, try it without the acdialog just to see if the Menu changed to the print preview... yeah the report will not be on top, but just try it to see the effect

are the form property modal/popup set to yes?
0
JARichardHIAuthor Commented:
okay, the popup was set to yes, but the modal wasn't, so I set those.  Now with or without the acDialog, the same thing happens.  Report opens up, to the appropriate record, but still no print preview menu options.
0
Rey Obrero (Capricorn1)Commented:
what is displayed in your Menu when you open the database?

also check the settings of the startup options

tools > startup
what options are checked?
0
JARichardHIAuthor Commented:
When I first open the data base the Home tab is open

and as far as startup options, is that located somewhere else in 2007?
0
Rey Obrero (Capricorn1)Commented:

    * it is best that you mention the version you are using when posting question.

print preview menu options  will only be available when you open your report in design view.
0
JARichardHIAuthor Commented:
Thanks for your help and for your patience.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.