Changing Color of Controls upon creation

G

Gil

I have a report which is created via VBA. I would like to change the
color of the controls depedning upon where in the VBA they are created.



Dim HealthInfo(0 To 5) As Control
Set HealthInfo(k) = CreateReportControl(OassisSummaryRpt.Name, acLabel,
, , "R", HealthPos, TaskNumberPos)


Shouldn't I be able to change the name of HealthInfo(k) by doing the
following:
HealthInfo(k).BackColor=vbBlack

??


I can't seem to change the colors..
Any Help would be greatly appreciated.

Thansk,
Gil
 
G

Gil

I'm now able to change properties of the labels:
Dim HealthInfo(0 To 5) As Label
Set HealthInfo(k) = CreateReportControl(OassisSummaryRpt.Name, acLabel,
, , "R", HealthPos, TaskNumberPos, 300)
HealthInfo(k).ForeColor = vbRed
HealthInfo(k).FontBold = True

HealthInfo(k).BackColor=vbRed does not have an effect. It works if I
dim the HealthInfo Array as TextBoxs, but then I can not insert default
values via VBA to the textboxes. Any suggestions?

thanks,
Gil
 
M

Marshall Barton

I am afraid that this kind of thing is such an unusual
approach that there is a vanishingly small number of people
with knowledge of the nuamces.

I want to emphasize that the Create... methods are only
appropriate in a Design Time wizard. For several important
reasons, these methods should never be used in a running
application.
 
G

Gil

Marsh,

I adjusted the database model to force some forms into handling most of
the VB script. In doing so I am able to use conditional formatting on
the reports, and that's about it!

Thanks for telling me it was an unusual approach, that made me rethink
what I was up to.

-Gil


Marshall said:
I am afraid that this kind of thing is such an unusual
approach that there is a vanishingly small number of people
with knowledge of the nuamces.

I want to emphasize that the Create... methods are only
appropriate in a Design Time wizard. For several important
reasons, these methods should never be used in a running
application.
--
Marsh
MVP [MS Access]

I'm now able to change properties of the labels:
Dim HealthInfo(0 To 5) As Label
Set HealthInfo(k) = CreateReportControl(OassisSummaryRpt.Name, acLabel,
, , "R", HealthPos, TaskNumberPos, 300)
HealthInfo(k).ForeColor = vbRed
HealthInfo(k).FontBold = True

HealthInfo(k).BackColor=vbRed does not have an effect. It works if I
dim the HealthInfo Array as TextBoxs, but then I can not insert default
values via VBA to the textboxes.
 

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

Top