Results 1 to 3 of 3
  1. #1
    Middlemarch is offline Competent Performer
    Windows 10 Access 2019
    Join Date
    Mar 2015
    Posts
    367

    Get caption from Label

    Not quite sure why I'm having a problem with this..


    I want me.lbl1.caption from a label control

    But the "1" is in a variable called num. So I'm trying
    Me.Controls("lbl" & Num & ".caption"
    and getting error 'Microsoft Access can't find the field 'lbl1.caption' referred to in your
    expression.'
    What am I doing wrong? Thanks.

  2. #2
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 11 Office 365
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,655
    try
    Code:
    Me.Controls("lbl" & Num).caption
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

  3. #3
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,445
    Or a bit shorter

    me(“lbl” & num).caption

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

Similar Threads

  1. I need to change the caption in a label
    By UT227 in forum Reports
    Replies: 3
    Last Post: 05-01-2022, 10:34 AM
  2. Result of query into label.caption ?
    By SpookiePower in forum Queries
    Replies: 7
    Last Post: 12-17-2013, 01:56 PM
  3. Getting Value as label Caption
    By Naveen Marapaka in forum Forms
    Replies: 4
    Last Post: 09-18-2013, 12:22 AM
  4. Replies: 6
    Last Post: 01-16-2013, 12:12 PM
  5. Set Label.Caption to field of recordsource
    By ngruson in forum Forms
    Replies: 1
    Last Post: 08-11-2010, 09:59 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