Changing label caption in Frame?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Pavan Arise

    Changing label caption in Frame?

    Hi all..
    This may seem simple..but I am stuck here! I have a frame in which
    I have a label. I was trying to change the caption of that label via
    code (I mean at runtime & not design time). But there is always an
    error saying "Compile error: Method or data member not found" I have
    no idea how to solve thsi problem. I have created my label on the
    frame itself. I tried to do it witha text box instead of a label...but
    in vain...the same error occurs. Though it may be very simple, I am
    not able to crack it. Can someone please help me out.I am stuck!!!
    Thanks in advance for any suggetsions or help.

    Regards,
    Pavan
  • Rick Rothstein

    #2
    Re: Changing label caption in Frame?

    > This may seem simple..but I am stuck here! I have a frame in which[color=blue]
    > I have a label. I was trying to change the caption of that label via
    > code (I mean at runtime & not design time). But there is always an
    > error saying "Compile error: Method or data member not found" I have
    > no idea how to solve thsi problem. I have created my label on the
    > frame itself. I tried to do it witha text box instead of a label...but
    > in vain...the same error occurs. Though it may be very simple, I am
    > not able to crack it. Can someone please help me out.I am stuck!!!
    > Thanks in advance for any suggetsions or help.[/color]

    You didn't supply any code to show what you were trying, so it is hard
    to know exactly what you are doing wrong. I'll try a guess though... to
    change the caption of a Label, you use its Caption property (Labels
    don't have a Text property). Assuming your Label is named Label1, change
    its caption like this...

    Label1.Caption = "New Label Caption Here"

    Rick - MVP

    Comment

    • David

      #3
      Re: Changing label caption in Frame?

      pavankarise@yah oo.com (Pavan Arise) wrote in message news:<ebda6084. 0408092148.3ffd [email protected] ogle.com>...[color=blue]
      > Hi all..
      > This may seem simple..but I am stuck here! I have a frame in which
      > I have a label. I was trying to change the caption of that label via
      > code (I mean at runtime & not design time). But there is always an
      > error saying "Compile error: Method or data member not found" I have
      > no idea how to solve thsi problem. I have created my label on the
      > frame itself. I tried to do it witha text box instead of a label...but
      > in vain...the same error occurs. Though it may be very simple, I am
      > not able to crack it. Can someone please help me out.I am stuck!!!
      > Thanks in advance for any suggetsions or help.
      >
      > Regards,
      > Pavan[/color]

      It sounds like you are trying to pull the text that you want to assign
      to the label or text box from a recordset. If this is the case, you
      probably have the fieldname spelled wrong or have not opened the
      recordset yet. To debug this and see what I mean (if I am right about
      you trying to pull from a recordset), change your label assignment to
      a declared string variable (Dim strTest as string). If you get the
      same error, then it where you are trying to pull data from. If you are
      pulling from a recordset, make sure:
      1) You have properly declared the recordset and connection (if you are
      using a connection to a data source)
      2) You have properly opened both the recordset and, if appropriate,
      the connection.
      3) You have spelled the column name correctly and used the proper
      syntax(rs!LastN ame and rs(0) are valid while rs.LastName is not)

      If you are not pulling from a recordset, then ignore all of the above
      and make sure you have your control name spelled correctly. :-)

      David

      Comment

      • Pavan

        #4
        Re: Changing label caption in Frame?

        dhodgkins@chest nut.org (David) wrote in message news:<83b47ff1. 0408100810.2658 [email protected] ogle.com>...[color=blue]
        > pavankarise@yah oo.com (Pavan Arise) wrote in message news:<ebda6084. 0408092148.3ffd [email protected] ogle.com>...[color=green]
        > > Hi all..
        > > This may seem simple..but I am stuck here! I have a frame in which
        > > I have a label. I was trying to change the caption of that label via
        > > code (I mean at runtime & not design time). But there is always an
        > > error saying "Compile error: Method or data member not found" I have
        > > no idea how to solve thsi problem. I have created my label on the
        > > frame itself. I tried to do it witha text box instead of a label...but
        > > in vain...the same error occurs. Though it may be very simple, I am
        > > not able to crack it. Can someone please help me out.I am stuck!!!
        > > Thanks in advance for any suggetsions or help.
        > >
        > > Regards,
        > > Pavan[/color]
        >
        > It sounds like you are trying to pull the text that you want to assign
        > to the label or text box from a recordset. If this is the case, you
        > probably have the fieldname spelled wrong or have not opened the
        > recordset yet. To debug this and see what I mean (if I am right about
        > you trying to pull from a recordset), change your label assignment to
        > a declared string variable (Dim strTest as string). If you get the
        > same error, then it where you are trying to pull data from. If you are
        > pulling from a recordset, make sure:
        > 1) You have properly declared the recordset and connection (if you are
        > using a connection to a data source)
        > 2) You have properly opened both the recordset and, if appropriate,
        > the connection.
        > 3) You have spelled the column name correctly and used the proper
        > syntax(rs!LastN ame and rs(0) are valid while rs.LastName is not)
        >
        > If you are not pulling from a recordset, then ignore all of the above
        > and make sure you have your control name spelled correctly. :-)
        >
        > David[/color]

        Thanks David & Rick for your help. I got it figured out. I was using
        Frame1.label.ca ption to modify the label. Anyway, I got a text box
        instead & got it to run smooth. Thanks again for your help.

        Regards,
        Pavan

        Comment

        Working...