Results 1 to 4 of 4
  1. #1
    thadius856 is offline Novice
    Windows 8 Access 2013
    Join Date
    Aug 2015
    Posts
    15

    Referencing Objects in Form Header/Footer?

    This should be a pretty darn easy thing to do, but I'm stumped and searches are coming up blank. How do I reference an object in my form's header/footer?

    I'm simply trying to set a label caption in Form_Load(), but the object name never shows up in the autocomplete and I get compile errors when it runs. I moved the object from the header into the body of the form and the script works fine, but then aesthetics suffer.



    I've tried all sorts of weird stuff, like:

    Me.FormHeader.MyObjectName.Caption = ...
    Me.Section(1).MyObjectName.Caption = ...
    Me.Section(ac_formheader).MyObjectName.Caption = ...
    etc etc ad naseum

    I'm sure it's right in front of my face, but I just can't see it. :|

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,646
    This works for me:

    Me.Label64.Caption = "NEW"
    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
    thadius856 is offline Novice
    Windows 8 Access 2013
    Join Date
    Aug 2015
    Posts
    15
    Quote Originally Posted by June7 View Post
    This works for me:

    Me.Label64.Caption = "NEW"
    That was the first thing I tried. I use it on just about all of my forms with no issue, but for some reason when the object is in the header it's not playing nice.

  4. #4
    thadius856 is offline Novice
    Windows 8 Access 2013
    Join Date
    Aug 2015
    Posts
    15
    Looks like when I swapped over to my new login splash screen, I forgot to also move the line that inits my globals on load.

    So when I was loading the form, the SQL statement that uses that global as its WHERE condition was returning no results instead of the UserID from the users table.

    It wasn't that the label didn't exist... it was that the global didn't. :| The generic "no object exists" error was throwing me off.

    Closing. Sorry for the false alarm.

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

Similar Threads

  1. Adding header and footer in Table
    By drunkenneo in forum Queries
    Replies: 6
    Last Post: 08-28-2013, 01:07 AM
  2. Replies: 1
    Last Post: 04-14-2013, 07:01 PM
  3. Header and Footer
    By tcheck in forum Access
    Replies: 1
    Last Post: 11-08-2012, 02:23 PM
  4. header and footer
    By slimjen in forum Forms
    Replies: 2
    Last Post: 10-03-2011, 08:10 PM
  5. Replies: 3
    Last Post: 08-31-2011, 02:34 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