Results 1 to 4 of 4
  1. #1
    Stephenson is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Sep 2015
    Location
    North West
    Posts
    110

    Control label caption based off of group header textbox value

    Hello all,



    I have an unbound label, lblTest that I would like to show the value of a textbox, tboRockProduct that is in a group header named ghRock. If tboRockProduct isnull I would like lblTest not to be visible.

    I've tried a few things thus far and been able to get lblTest to not be visible, but have not been able to get it to show the value of tboRockProduct. I've used variations of the following code.

    Code:
    Private Sub Report_Load()  
    With ghRock
       If Not IsNull(tboRockProduct) Then
        Me.lblTest.Caption = tboRockProduct
        ElseIf IsNull(tboRockProduct) Then
        Me.lblTest.Visible = True
    End If
    End With
    End Sub
    Is this not possible as the report continues and the value of tboRockProduct varies? I'm happy to hear any suggestions you may have to help.

    Thank you for looking.

  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,770
    Consider a textbox with expression in ControlSource and code in the Detail section Format event. Format event only triggers when printing or PrintPreview.
    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
    Stephenson is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Sep 2015
    Location
    North West
    Posts
    110
    Thank you for the suggestion June7. I will give this a try

  4. #4
    Stephenson is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Sep 2015
    Location
    North West
    Posts
    110
    June7,

    Thank you for the help. I used

    Code:
    =IIf(IsNull([tboRockProduct]),"",[VendorName])
    As the control source for my textbox and it worked like a charm.

    Great idea.

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

Similar Threads

  1. Result of query into label.caption ?
    By SpookiePower in forum Queries
    Replies: 7
    Last Post: 12-17-2013, 01:56 PM
  2. Getting Value as label Caption
    By Naveen Marapaka in forum Forms
    Replies: 4
    Last Post: 09-18-2013, 12:22 AM
  3. Replies: 5
    Last Post: 06-28-2011, 06:40 PM
  4. Replies: 3
    Last Post: 01-13-2011, 03:53 AM
  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