Results 1 to 11 of 11
  1. #1
    Lukael is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Posts
    239

    Position form in upper right corner of other form ?

    Hi,



    I created a form with "Print","Save to PDF" and "E-mail" buttons to show them when Report is opened in print preview mode. How can I posititon this form to open in upper right corner of Report ?

    I tried this, but form doesn't open exactly in right corner:

    Code:
    DoCmd.OpenForm "ReportButtons", acNormal
    Forms![ReportButtonsj].Move Left:=Reports![MyReport].WindowLeft + Reports![MyReport].Width - Forms![ReportButtonsj].Width, Top:=Reports![MyReport].WindowTop
    Any ideas ?

  2. #2
    cyanidem's Avatar
    cyanidem is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    Nov 2015
    Location
    Consett, UK
    Posts
    270
    So where does it open? Screenshot?

  3. #3
    Lukael is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Posts
    239
    Here it is, take a look.
    Attached Thumbnails Attached Thumbnails Untitled.jpg  

  4. #4
    cyanidem's Avatar
    cyanidem is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    Nov 2015
    Location
    Consett, UK
    Posts
    270
    No idea why would it position it this way.
    Have you tried DoCmd.MoveSize in Resize event instead of Form.Move?

  5. #5
    cyanidem's Avatar
    cyanidem is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    Nov 2015
    Location
    Consett, UK
    Posts
    270
    Oh, BTW, I don't know if it's spelling mistake or on purpose:
    Code:
    DoCmd.OpenForm "ReportButtons", acNormal
    Forms![ReportButtonsj].Move Left:=Reports![MyReport].WindowLeft + Reports![MyReport].Width - Forms![ReportButtonsj].Width, Top:=Reports![MyReport].WindowTop
    ReportButtons - ReportButtonsj

  6. #6
    cyanidem's Avatar
    cyanidem is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    Nov 2015
    Location
    Consett, UK
    Posts
    270
    Looks like it somehow doesn't consider window frames. I got different results depending on Border Style (None, Thin, Dialog, etc.)
    So I guess it's just up to trial and error method. You need to move it a bit down and right manually in code.

  7. #7
    Lukael is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Posts
    239
    Oh, BTW, I don't know if it's spelling mistake or on purpose:
    Yes It's a mistake, I replace my code for better understanding.

    No idea why would it position it this way.
    I believe that It has to do something with Report print preview - size of Report is smaller than print preview, so windows move based to print preview and not Report Itself.

    I'm trying with Do.cmd MoveSize now, but whatever I try It keeps opening in weird places. I'll have to test a little bit. Or do you maybe know what should work ?

  8. #8
    cyanidem's Avatar
    cyanidem is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    Nov 2015
    Location
    Consett, UK
    Posts
    270
    Maybe because .MoveSize uses different coordinates (Right, Down, Width, Height) than .Move (Left, Top, Width, Height).

  9. #9
    Lukael is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Posts
    239
    So I guess it's just up to trial and error method. You need to move it a bit down and right manually in code.
    I would do manually, but unfortunally that doesn't work on different screen resolutions, and I need that. Damn, why cant Print preview just allow command buttons, It's all because of that.

  10. #10
    cyanidem's Avatar
    cyanidem is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    Nov 2015
    Location
    Consett, UK
    Posts
    270
    Maybe create custom ribbon for report print preview only with those buttons you need?

  11. #11
    Lukael is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Posts
    239
    No, I cannot create ribbon for that, I actually hide ribbon in my app. I tried this and It works better :

    Code:
    Forms![ReportButtons].Move Left:=Reports![MyReport].WindowLeft + Reports![MyReport].WindowWidth - Forms![ReportButtons].Width, Top:=Reports![MyReport].WindowTop

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Position of Form Upon Opening
    By jsimard in forum Forms
    Replies: 2
    Last Post: 08-08-2014, 01:49 PM
  2. Open form at fixed position using VBA
    By aspfun in forum Programming
    Replies: 12
    Last Post: 05-09-2013, 02:26 PM
  3. Replies: 8
    Last Post: 05-10-2012, 10:57 AM
  4. Get position of record in continuous form
    By Whizbang in forum Forms
    Replies: 3
    Last Post: 11-02-2011, 01:47 PM
  5. Set Form Position
    By Yance in forum Programming
    Replies: 3
    Last Post: 11-29-2010, 02:20 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums