By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,313 Members | 1,240 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,313 IT Pros & Developers. It's quick & easy.

Changing label caption in Frame?

P: n/a
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
Jul 17 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
> 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.


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

Jul 17 '05 #2

P: n/a
pa*********@yahoo.com (Pavan Arise) wrote in message news:<eb**************************@posting.google. com>...
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


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!LastName 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
Jul 17 '05 #3

P: n/a
dh*******@chestnut.org (David) wrote in message news:<83**************************@posting.google. com>...
pa*********@yahoo.com (Pavan Arise) wrote in message news:<eb**************************@posting.google. com>...
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


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!LastName 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


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

Regards,
Pavan
Jul 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.