Results 1 to 6 of 6
  1. #1
    ItsRoland is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jun 2018
    Posts
    111

    Reset Position of Controls in Design View

    I have a lot of controls in forms that move around dynamically depending on a few different things (specifically talking about the '.Top' property). Some of these forms will reset the position of the controls to their original position when moving to design view, but some don't, which causes a lot of controls to overlap. This means I need to fix the position of all my controls when I enter design view if I want to make changes.



    I can't figure out what the difference is between the forms that reset the position of controls and the ones that do not. I tried putting code in the On_Close and On_Unload events to reset the positions, but this gives me the error "object either does not exist or isn't open" no matter which event I used.

    How do I ensure the controls will reset back to their original positions when in design view?

    Any help is appreciated!

  2. #2
    Minty is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,144
    It's generally considered poor practice to actually move controls in a form, and unless you are using
    Code:
    DoCmd.Save
    Somewhere those form changes shouldn't be saved. If this was being run in runtime or a compiled accde, it would crash.

    It's far more normal to hide and unhide controls as you need them, they can overlap when hidden and it doesn't matter.
    If you have too many controls to fit on a normal sized form consider using tabbed pages on one form.
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  3. #3
    ItsRoland is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jun 2018
    Posts
    111
    The controls are being hidden when they are overlapping in form view. There are no issues with the form when in form view.

    Controls will become hidden if there isn't a value to give them, and the controls underneath are moved up. This causes overlap, which, as you stated, doesn't matter because the controls underneath are hidden. However, when I enter design view, the controls don't go back to their original position and thus the overlap remains. This only happens on some of my forms, not all of them, and in the past has inexplicably stopped happening. I can't figure out what causes the buttons to hold the position they get in form view when in design view.


    'DoCmd.Save' appears nowhere in any of my code, so that's not the issue.

    I'm not moving controls around due to lack of space, I'm moving them around to keep things dynamic, that way there isn't a large empty space between controls where the hidden one's are.


    My apologies for the confusion.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,646
    I do this but do not encounter the issue. Controls are always in their original position.

    I disable the X close and use command button to close all forms.

    DoCmd.Close acForm, Me.Name, acSaveNo

    However, I think acSaveNo is default.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    ItsRoland is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jun 2018
    Posts
    111
    Whats weird is this has never happened for me either. It only started occurring recently, and in a few cases it stopped happening on its own. I imagine this is why I couldn't find anything about it during my search.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,646
    Maybe decompile then recompile db. That has fixed some weird behavior for me.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 8
    Last Post: 05-01-2017, 04:58 PM
  2. Replies: 4
    Last Post: 08-26-2015, 08:47 AM
  3. Replies: 4
    Last Post: 04-09-2015, 07:52 PM
  4. NOOB - moving controls in design view
    By brettnolan in forum Access
    Replies: 4
    Last Post: 04-24-2014, 05:37 PM
  5. Replies: 8
    Last Post: 01-21-2011, 03:36 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