Horizontal Positions

  • Thread starter Thread starter mrmarmite
  • Start date Start date
M

mrmarmite

Hi,

I have a report where I would like to show only the labels of a Yes/No
box if the value of that box is True. I include the following code
which works just fine. However, Each of these labels is to the right of
the one before it, in the layout. Therefore, for example, if Feature1
was True, Feature2 False and Feature3 True the report would show
Feature1 Feature 3, ie with a gap between them.
What Iwould like to do is concatenate these labels. The obvious way to
do that would be to define the left positon of the label. If it's True,
then add a value to that left position for the placement of the next
True label. However, I can't see to find any VB that will allow me to
set the left position of the label. Any help anyone?

Thanks

James

If Me![Feature1] Then
Me!Label_Feature1.Visible = True
Else
Me!Label_Feature1.Visible = False
End If

If Me![Feature2 Then
Me!Label_Feature2Visible = True
Else
Me!Label_Feature2.Visible = False
End If

If Me![Feature3] Then
Me!Label_Feature3.Visible = True
Else
Me!Label_Feature3.Visible = False
End If
 
Label controls have a Left property that can be changed when running the
report.

I think your basic issue is one of un-normalized tables. Each "feature"
should create a new record in a related table rather than a value in a
"feature field". A normalized table structure would allow you to use a
multiple column subreport to display your results. This would involve no
code.
 
Thanks. Assuming the table is not in the format you mention, how does
the Left Property for the label work?

Thanks
 
You would need code in your section format event like:

Me.lblLabelControlName.Left = [some number or expression]
 
so in my example, this should work?

f Me![Feature1] Then
Me.Label_Feature1.Left = [600]
Me!Label_Feature1.Visible = True

Else
Me!Label_Feature1.Visible = False
End If

If Me![Feature2 Then
Me!Label_Feature2Visible = True
Else
Me!Label_Feature2.Visible = False
End If

If Me![Feature3] Then
Me!Label_Feature3.Visible = True
Else
Me!Label_Feature3.Visible = False
End If

Thanks
 
Your number shouldn't be in []s. You also have some typos with missing "]"
and ".". Otherwise your code should work. You aren't setting the label's
Left property if Feature1 is False.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top