Re: How can I format label name as I loop through records?
- From: "Dirk Goldgar" <dg@xxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 4 Jul 2005 14:38:36 -0400
"David Anderson" <DavidAnderson@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
message news:15E4EEB8-E99E-49F6-94DB-F21FAB370F7C@xxxxxxxxxxxxx
> I have a subform with a relatively small (under 40) maximum number of
> records for each main form record. I'm using a tab control to
> identify all the potential subform records, whether present or not
> (this is a cosmetic feature - no data is actually stored on the tab
> control pages). My application is working fine but I would like to
> add an indicator above each tab to show whether or not that
> particular record exists.
>
> I have created small 'marker' labels above each tab and want to make
> these labels visible when the subform record is missing (and vice
> versa). My plan is to loop through the recordsetclone of the subform
> and hide the labels for all the records I find. All other marker
> labels would then be made visible. The labels have been given the
> names TabFlag0, TabFlag1, TabFlag2 ....... TabFlag38.
>
> My problem is that I can't currently think of a way to automatically
> select the correct label as I step through the loop. Obviously I need
> to concatenate "TabFlag" and the current loop counter value but I
> don't know how to create an executable line of code using this
> assembled label name.
>
> I suspect that there is a very simple solution ........
I wonder about your design, since it's usually a bad idea to embed data
content in form design, as you appear to be doing with your tabs and
labels. However, the simple answer to your question is to concatenate
the "TabFlag" prefix with your loop counter and use the result as a
string index into the Control collection, like this:
Dim I As Integer
For I = 0 to 38
Me.Controls("TabFlag" & I).Visible = False
Next I
--
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)
.
- Follow-Ups:
- Re: How can I format label name as I loop through records?
- From: David Anderson
- Re: How can I format label name as I loop through records?
- References:
- How can I format label name as I loop through records?
- From: David Anderson
- How can I format label name as I loop through records?
- Prev by Date: Re: How can I format label name as I loop through records?
- Next by Date: Nested IF Problem
- Previous by thread: Re: How can I format label name as I loop through records?
- Next by thread: Re: How can I format label name as I loop through records?
- Index(es):
Relevant Pages
|