|
Prev: change text box color in a report
Next: stellenangebote bremen Biologe Biologin stellenangebot technik stellenangebote klinikum jobs stellenangebot stellenangebot geschichte Zimmerer Zimmermann jobangebote usa
From: J Lagos on 6 Jul 2008 11:47 The intent is to cycle through text boxes on a reports detail section and change the backcolor depending on the text box value. the debug.print seems to indicate that the value is coming through, but the backcolor isn't changing to correspond. here's the code: (if anyone has more brains that me on this..I'm missing something here) Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer) Dim ctl As Control Dim strV Const conTransparent = 0 Const conWhite = 16777215 Const conRed = 255 For Each ctl In Me.Controls With ctl If .ControlType = acTextBox And .Section = acDetail Then strV = ctl strV = Right(strV, 1) .BackStyle = acNormal Debug.Print ctl.Name Debug.Print strV Select Case strV Case Is = "R" .BackColor = 255 Case Is = "L" .BackColor = 1 Case Else End Select End If End With Next ctl End Sub
From: Mark on 6 Jul 2008 13:54 1. You don't need the constants (Const) since you are specifying the actual value of backcolor 2. You don't need the variable strV to do what you want 3. In your Select Case statement, you are looking at the values (strV) your controls might have rather than than the value of the controls Steve "J Lagos" <rushrules__(a)shaw.ca> wrote in message news:%N5ck.60634$Jx.18913(a)pd7urf1no... > The intent is to cycle through text boxes on a reports detail section and > change the backcolor depending on the text box value. > > the debug.print seems to indicate that the value is coming through, but > the backcolor isn't changing to correspond. > > here's the code: (if anyone has more brains that me on this..I'm missing > something here) > > Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer) > Dim ctl As Control > Dim strV > > Const conTransparent = 0 > Const conWhite = 16777215 > Const conRed = 255 > For Each ctl In Me.Controls > > With ctl > If .ControlType = acTextBox And .Section = acDetail Then > strV = ctl > strV = Right(strV, 1) > .BackStyle = acNormal > Debug.Print ctl.Name > Debug.Print strV > Select Case strV > Case Is = "R" > > .BackColor = 255 > > Case Is = "L" > .BackColor = 1 > > Case Else > > End Select > End If > End With > > Next ctl > > End Sub
From: Stuart McCall on 6 Jul 2008 13:55 "J Lagos" <rushrules__(a)shaw.ca> wrote in message news:%N5ck.60634$Jx.18913(a)pd7urf1no... > The intent is to cycle through text boxes on a reports detail section and > change the backcolor depending on the text box value. > > the debug.print seems to indicate that the value is coming through, but > the backcolor isn't changing to correspond. > > here's the code: (if anyone has more brains that me on this..I'm missing > something here) > > Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer) > Dim ctl As Control > Dim strV > > Const conTransparent = 0 > Const conWhite = 16777215 > Const conRed = 255 > For Each ctl In Me.Controls > > With ctl > If .ControlType = acTextBox And .Section = acDetail Then > strV = ctl > strV = Right(strV, 1) > .BackStyle = acNormal > Debug.Print ctl.Name > Debug.Print strV > Select Case strV > Case Is = "R" > > .BackColor = 255 > > Case Is = "L" > .BackColor = 1 > > Case Else > > End Select > End If > End With > > Next ctl > > End Sub Is your control's BackStyle property set to Normal? If so, set it to Transparent.
From: StopThisAdvertising on 6 Jul 2008 18:43 "Mark" <emasil(a)email.org> schreef in bericht news:uridnXHaV8pLm-zVnZ2dnUVZ_hCdnZ2d(a)earthlink.com... > 1. You don't need the constants (Const) since you are specifying the > actual value of backcolor > 2. You don't need the variable strV to do what you want > 3. In your Select Case statement, you are looking at the values (strV) > your controls might have rather than than the value of the controls > > Steve -- Hey Mark/Steve!! We don't need you here !! Hey Mark/Steve!! We don't want you here !! This is to inform 'newbees' here about PCD' Steve: http://home.tiscali.nl/arracom/whoissteve.html (updated, mainly the 'abuse-reporting' page...) Until now 5850+ pageloads, 3675+ first-time visitors (these figures are real and rapidly increasing) Why is this ??? Because Steve is the ONLY person here who continues to advertise in the groups. It is not relevant whether he advertised in *this* particular post or not... ==> We want him to know that these groups are *not* his private hunting grounds! For those who don't like too see all these messages: ==> Simply killfile 'StopThisAdvertising'. Newbees will still see this warning-message. ArnoR
From: Stuart McCall on 6 Jul 2008 19:06
Errata: > Is your control's BackStyle property set to Normal? If so, set it to > Transparent. should have been: Is your control's BackStyle property set to Transparent? If so, set it to Normal. Duh. |