Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old January 20th, 2006, 05:45 PM
Rico
Guest
 
Posts: n/a
Default Reference a field labels caption?

Hello,

I'm looping through controls on a form, focusing on text boxes. If the field
is null and I'd like to throw a pop up letting the user know that this
"required" textbox is not filled out. If I show the user
"control.controlname" then I get the txtThisIsMyField and it doesn't help
the user much. I'd like to reference caption of the fields bound label. Is
there any way of doing that?

Thanks!


  #2  
Old January 20th, 2006, 05:55 PM
RoyVidar
Guest
 
Posts: n/a
Default Re: Reference a field labels caption?

Rico wrote in message <Yc9Af.409363$ki.298102@pd7tw2no> :[color=blue]
> Hello,
>
> I'm looping through controls on a form, focusing on text boxes. If the field
> is null and I'd like to throw a pop up letting the user know that this
> "required" textbox is not filled out. If I show the user
> "control.controlname" then I get the txtThisIsMyField and it doesn't help the
> user much. I'd like to reference caption of the fields bound label. Is
> there any way of doing that?
>
> Thanks![/color]

To reach the caption of an attached label, try some of the following
air code

for each ctl in me.controls
if <some condition> then
if ctl.controls.count > 0 then
' to ensure there is an attached label
msgbox ctl.controls(0).caption
else
msgbox ctl.name
end if
end if
next ctl

--
Roy-Vidar


  #3  
Old January 20th, 2006, 05:55 PM
Allen Browne
Guest
 
Posts: n/a
Default Re: Reference a field labels caption?

If the control has an attached label, you can read its caption as:
ctl.Controls(0).Caption

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Rico" <r c o l l e n s @ h e m m i n g w a y . c o mREMOVE THIS PART IN
CAPS> wrote in message
news:Yc9Af.409363$ki.298102@pd7tw2no...[color=blue]
> Hello,
>
> I'm looping through controls on a form, focusing on text boxes. If the
> field is null and I'd like to throw a pop up letting the user know that
> this "required" textbox is not filled out. If I show the user
> "control.controlname" then I get the txtThisIsMyField and it doesn't help
> the user much. I'd like to reference caption of the fields bound label.
> Is there any way of doing that?[/color]


 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles