CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    May 2005
    Posts
    23

    adding text to label in access form using vba

    hi
    can some1 pls help i have created a form in access using vba. in that form i am adding label control, the code to add a label is as follows:

    Set ctl = CreateControl(frms.Name, acLabel, acDetail, , , intDataX, intDataY)

    after adding the label i need to add text on the label, how to add the text can some1 pls help

    thnxs in advance

  2. #2
    Join Date
    May 2005
    Posts
    26

    Re: adding text to label in access form using vba

    Just set the Caption of your Label to the value that you want.
    Code:
    Label1.Caption = strText

  3. #3
    Join Date
    Mar 2014
    Posts
    3

    Exclamation Re: adding text to label in access form using vba

    Quote Originally Posted by aldowsary View Post
    Just set the Caption of your Label to the value that you want.
    Code:
    Label1.Caption = strText

    The above code works fine ,but the caption only display when the user click the Label ,kindly drop some code to display the Label caption Automatically please

  4. #4
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: adding text to label in access form using vba

    That code works fine.

    If it is only working when the user clicks the label then that is because you put the code in the label_click event.

    In other words you told it to work that way.

    If you want the text to appear under different conditions then you need to put the code in the right place to meet those conditions. Nothing really happens automatically you have to tell it what to do and we can't tell you how if we don't know what you are trying to do.

    For future questions start your own thread rather than reviving one that is 9 years old
    Always use [code][/code] tags when posting code.

  5. #5
    Join Date
    Mar 2014
    Posts
    3

    Re: adding text to label in access form using vba

    Sorry to ask my question in old post ,how to start new thread ??

  6. #6
    Join Date
    Mar 2014
    Posts
    3

    Re: adding text to label in access form using vba

    Actually i like to create one form but the caption of the form always display only when we click on the label can any one help with some codes please

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured