Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 2 / June 2007

Tip: Looking for answers? Try searching our database.

Setting a Label's BackColor by Code

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bob Barnes - 19 Jun 2007 19:34 GMT
No problem setting a textbox's BackColor by code, but...

i'm using in...
Private Sub ReportHeader_Format(Cancel As Integer, FormatCount As Integer)

...snippet...
Where B and C are Doubles...
B = CDbl(AShrink.Caption): C = CDbl(ATotalRepair.Caption)
lbl433.Caption = Format((B / C) * 100, "#0.0") & "%"
If IsNumeric(Left(lbl433.Caption, 2)) Then
I = CInt(Left(lbl433.Caption, 2))
If I >= 10 Then lbl433.BackColor = 255
End If

It WILL run the "...If I >= 10 Then lbl433.BackColor = 255",
but the BackColor (on one label ONLY...the others work properly)
will be white when the Report opens.

Ideas...please.

TIA - Bob
Wayne-I-M - 19 Jun 2007 20:37 GMT
Hi Bob

Why not copy a lable that does work and change the code to reference this
new lable and see if this works - worth a try

Signature

Wayne
Manchester, England.

> No problem setting a textbox's BackColor by code, but...
>
[quoted text clipped - 17 lines]
>
> TIA - Bob
Bob Barnes - 19 Jun 2007 21:04 GMT
Wayne-I-M....I tried it...and instead of naming the copied label
"lbl267", I kept "Label267", and...

It WORKED...now...why?  Is this a "fix" from your experience???

Thank you - Bob

> Hi Bob
>
[quoted text clipped - 22 lines]
> >
> > TIA - Bob
Wayne-I-M - 19 Jun 2007 22:18 GMT
Ha Ha LoL

No

But sometime things are just "bust".  So it sometimes helps to simply press
the delete button.  Of course there is normally a good reason why thing don't
work - but (this is my expereince) something just are not wrth the time
worrying about.  If you can get them to work - fine, if not then it may be
worth looking at in more details.

Glad it worked for you
Signature

Wayne
Manchester, England.

> Wayne-I-M....I tried it...and instead of naming the copied label
> "lbl267", I kept "Label267", and...
[quoted text clipped - 29 lines]
> > >
> > > TIA - Bob
Bob Barnes - 20 Jun 2007 02:23 GMT
Thanks again...This is going into "My Tool Bag"...
IF it doesn't work someday, we'll try for another solution.

Bob

> Ha Ha LoL
>
[quoted text clipped - 41 lines]
> > > >
> > > > TIA - Bob
Wayne-I-M - 20 Jun 2007 08:48 GMT
Hi Bob

I created a butoon called LableGoAway  and used both of your lable names to
see if there was anything there that would have caused the problem you
descibed and it didn't so I don't think it was the name that was causeing the
problem.  Without looking at the other - interrelated - codes and controls,
on your form there is not a lot I can say other than if it works now thats
good but if it doesn't work in the future you could repost with more details.

Create a button LableGoAway and  lables   Label186 and lbl186 and use this
OnClick of the button to test the names.

Private Sub LableGoAway_Click()
  If Me.lbl186.Visible = True Then
  Me.lbl186.Visible = False
Else
  Me.lbl186.Visible = True
End If

If Me.Label186.Visible = True Then
  Me.Label186.Visible = False
Else
  Me.Label186.Visible = True
End If
  End Sub

As you can see - clicking again and again on the button hides and unides the
lables so not much there to cause the problem

Signature

Wayne
Manchester, England.

> Thanks again...This is going into "My Tool Bag"...
> IF it doesn't work someday, we'll try for another solution.
[quoted text clipped - 46 lines]
> > > > >
> > > > > TIA - Bob
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.