Results 1 to 8 of 8
  1. #1
    s3tucson is offline Novice
    Windows 10 Access 2016
    Join Date
    Oct 2019
    Posts
    5

    Setting the .Top property for a label object

    Hi guys, I'm running into an issue setting the .Top property of a label objective (via VBA) in a form. I am using the following example to set the position:



    Reports![Report Name]![Label Name].Top = 4680 <-- This number is in twips

    I consistently receive the "The setting you entered isn't valid for this property." message in Access 2016. The label object is recognized, as I am able to successfully set the .Visible property.

    Any help would be appreciated! Thanks in advance

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,915
    You say "in a form" yet code references a report.

    Have set Top property of controls in form and report. What event are you using?

    Formatting code for controls in report sections must be in section OnFormat or OnPrint event.
    Last edited by June7; 10-05-2019 at 02:18 PM.
    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.

  3. #3
    s3tucson is offline Novice
    Windows 10 Access 2016
    Join Date
    Oct 2019
    Posts
    5
    You are 100% correct, sorry about that. This is being handled in a report on an OnPrint event; which is being called properly due to the comment about the .Visible property being set.

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,915
    Just tested. Works in OnFormat, not OnPrint.

    I've never used OnPrint.
    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
    s3tucson is offline Novice
    Windows 10 Access 2016
    Join Date
    Oct 2019
    Posts
    5
    It also just worked for me, great suggestion with OnFormat. It appears there is a limitation with OnPrint and object changes. Thanks for help!

  6. #6
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,975
    Whilst this works using the OnFormat event, using this means it has to be done each time the report is printed/previewed.
    Why not just do it once? Move it to the required position in design view and save the report.
    Then the event procedure isn't required.
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  7. #7
    s3tucson is offline Novice
    Windows 10 Access 2016
    Join Date
    Oct 2019
    Posts
    5
    Thanks for additional response. The report is dynamic in nature based on certain criteria within the query.

  8. #8
    s3tucson is offline Novice
    Windows 10 Access 2016
    Join Date
    Oct 2019
    Posts
    5
    Hi guys, challenge solved. Thanks again for the help!

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

Similar Threads

  1. Replies: 7
    Last Post: 06-07-2018, 04:49 PM
  2. Setting Control Source Property Issue
    By Sarah11 in forum Forms
    Replies: 2
    Last Post: 09-23-2017, 10:37 PM
  3. Format a Label Object in a report
    By louise in forum Reports
    Replies: 1
    Last Post: 07-09-2015, 07:01 AM
  4. Setting visible property of subreport?
    By GaryElwood in forum Reports
    Replies: 1
    Last Post: 09-23-2011, 07:49 PM
  5. Replies: 1
    Last Post: 08-12-2010, 10:33 PM

Tags for this Thread

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