Setting a window to a certain position on my screen

Hi experts,

When I click on my print preview command button, the correct report opens up but over the top of the form that has the command button on it.  I would like to click the report command button and have the print preview window set to a certain size and in a certain position on the page.  For example, how would I set up the code so that the print preview window only opened from the middle of the screen to the right hand side of the screen?

Thank you for any help.

Who is Participating?
Rey Obrero (Capricorn1)Connect With a Mentor Commented:

did you try it like this

Private Sub Report_Open(Cancel As Integer)

DoCmd.MoveSize 10000

End Sub
Rey Obrero (Capricorn1)Commented:
in the open event of the report

docmd.movesize <right value>, <down value>      'values is in twips

     docmd.movesize 10000, 500
TerenceHewettAuthor Commented:
Hi Capricorn, sorry for the delayed response.  I have tried your suggestion, but this does not work.  Any suggestions as to why?  I have tried in the OnOpen of the report and also the OnFormat of the report, but no joy.

Kind regards,
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

TerenceHewettAuthor Commented:
Thanks Cap for the help.  I tried your later suggestion and it worked.


PS: Apologise for the delay in awarding points.
TerenceHewettAuthor Commented:
Hi Cap.

I thought this had worked, but it had not.   I have tried creating a macro with the movesize command also but this has not worked either.  I have no idea what I am doing wrong.  In the Access help it says that it is possible to MoveSize in reports, but it is not working for me.  The report opens in full screen print preview and when I click the very top left corner (app icon) the Move and Size are greyed out.  Can anybody help?

Thank you.

PS: I will repost if that is preferred.
Rey Obrero (Capricorn1)Commented:
<report opens in full screen print preview>

if it is maximized, you won't see it moved. there should be enough space to the right.
try resizing it.

Rey Obrero (Capricorn1)Commented:
try this

private sub cmdPreview_click()          '<< just  change the name of the command button

dim sRep as string
srep="NameOfReport"          '<<< change the name of the report

docmd.openreport, srep, acviewpreview
docmd.movesize 10000

end sub
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.