Results 1 to 9 of 9
  1. #1
    AmanKaur123 is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jan 2017
    Posts
    47

    Change top of each control

    Hi All



    I have a Box with the checkboxes and labels. All of them have Tag "B" but now my question is if I want to move the top of each of these bit up then how this can be done? I want to move the position of that box with the checkboxes. If I write the following code then the top property doesn't work :

    Code:
    For Each ctr In Me.Controls
        If ctr.Tag = "B" Then
           ctr.Visible = True
          ctr.top=????         ' I can see TopPadding option instead
        End If
    Next ctr
    Any help will be much appreciated.

    Thanks

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    why wouldnt you set .TOP in design mode?

  3. #3
    AmanKaur123 is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jan 2017
    Posts
    47
    This is because based on the options selected I have to make the controls invisible or visible and move the position(Top) of them .

  4. #4
    AmanKaur123 is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jan 2017
    Posts
    47
    any help on this guys???

  5. #5
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Why not make them enabled/disabled instead, they will be grayed out and the form will not need to be redesigned all the time.

  6. #6
    AccessPower's Avatar
    AccessPower is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Oct 2016
    Posts
    165
    Have to tried to use the top property as you have it now? Just because you don't see it doesn't mean it won't be available. Also, if you're looking at getting a value for top, you can always get the current value to see how it is formatted by using debug.print ctr.top. Access assigns an inch value to 1440 in VBA for a few properties. Not sure if it works for the top property too.

  7. #7
    AmanKaur123 is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jan 2017
    Posts
    47
    Thanks Accesspower. I will try it

  8. #8
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    If you created the Form using the Wizard, the Controls are all 'connected,' if you will, i.e. one Control cannot be moved around independent of the other Controls, and this may be the problem, when trying to position a given Control. In Form Design View

    1. Select all Controls in the Detail Section of the Form
    2. Click on the Arrange Tab on the Ribbon
    3. Click on the Remove Icon
    4. Try moving the Control now

    Linq ;0)>

  9. #9
    Micron is offline Very Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    To answer your question about not seeing .Top:
    Not all properties or methods are shown by Intellisense when you declare a control as an object. I suspect you dim'd ctr although you don't show that.
    To verify, type Me.txtNameOfControl. and Top should show in the list. I supposed the reason is that the MS decided to put what db designers would most likely need in order to keep the list from being huge. Probably a good decision.

    If your controls are not part of a group as Missingliq is thinking, your way should work. And yes, the vba value is in twips (roughly 1440 per inch).
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

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

Similar Threads

  1. Replies: 3
    Last Post: 03-21-2016, 07:03 AM
  2. Replies: 2
    Last Post: 10-03-2014, 10:07 AM
  3. a loop using vba to change control name
    By Chuck55 in forum Programming
    Replies: 4
    Last Post: 04-23-2012, 09:23 PM
  4. how can change one control in whole rows
    By smahdih in forum Reports
    Replies: 5
    Last Post: 11-20-2011, 02:42 PM
  5. Change date from another control
    By NOTLguy in forum Forms
    Replies: 3
    Last Post: 11-20-2010, 11:24 AM

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