Change Field BackColours When A Tickbox Is True

B

Bateman28

Hi

I am trying to figure out how to change certain fields when a tickbox is
ticked to the value of True. My Tickbox is named WDAccessed.

I have tried the following;

Private Sub WDAccessed_Click()

If Me![WDAccessed] = True Then

Me![FullName.BackColour] = 255 Colour Red
Me![WorkDueDate.BackColour] = 255 Colour Red

Else

Me![FullName.BackColour] = -2147483643 Normal BackColour
Me![WorkDueDate.BackColour] = 2147483643 Normal BaclColour

End If
End Sub

Any help would be great.....Cheers
 
D

Dennis

Me.ControlName.BackColor = xxxx

I don't believe that the Brit spelling of "colour" works, but I could be
fulla crap (wouldn't be the first time - heh)
 
B

Bateman28

Cheers for the quick reply,

are you basically saying that the code i have used is correct and to just
try and change the Spelling of colour from English to the USA spelling of
Color??

Sorry but my heads had about enough for a monday so its running alittle slow!!

Dennis said:
Me.ControlName.BackColor = xxxx

I don't believe that the Brit spelling of "colour" works, but I could be
fulla crap (wouldn't be the first time - heh)

Bateman28 said:
Hi

I am trying to figure out how to change certain fields when a tickbox is
ticked to the value of True. My Tickbox is named WDAccessed.

I have tried the following;

Private Sub WDAccessed_Click()

If Me![WDAccessed] = True Then

Me![FullName.BackColour] = 255 Colour Red
Me![WorkDueDate.BackColour] = 255 Colour Red

Else

Me![FullName.BackColour] = -2147483643 Normal BackColour
Me![WorkDueDate.BackColour] = 2147483643 Normal BaclColour

End If
End Sub

Any help would be great.....Cheers
 
D

Dennis

I always used the syntax that I specified in my initial reply:

"Me.myControlName.BackColor = xxxx"

where "myControlName" is the name of the control(s) that you are working
with, and (of course) "xxxx" is the color number. One thing I did notice is
that for Access 2007, I needed to use an "RGB" statement and specify the
individual color component values. I absolutely HATE doing it that way.




Bateman28 said:
Cheers for the quick reply,

are you basically saying that the code i have used is correct and to just
try and change the Spelling of colour from English to the USA spelling of
Color??

Sorry but my heads had about enough for a monday so its running alittle slow!!

Dennis said:
Me.ControlName.BackColor = xxxx

I don't believe that the Brit spelling of "colour" works, but I could be
fulla crap (wouldn't be the first time - heh)

Bateman28 said:
Hi

I am trying to figure out how to change certain fields when a tickbox is
ticked to the value of True. My Tickbox is named WDAccessed.

I have tried the following;

Private Sub WDAccessed_Click()

If Me![WDAccessed] = True Then

Me![FullName.BackColour] = 255 Colour Red
Me![WorkDueDate.BackColour] = 255 Colour Red

Else

Me![FullName.BackColour] = -2147483643 Normal BackColour
Me![WorkDueDate.BackColour] = 2147483643 Normal BaclColour

End If
End Sub

Any help would be great.....Cheers
 
D

Dirk Goldgar

Dennis said:
One thing I did notice is
that for Access 2007, I needed to use an "RGB" statement and specify the
individual color component values. I absolutely HATE doing it that way.


I'm not following you. I don't find that I have to do that, when specifying
colors in code. The property sheet shows colors as "#rrggbb" values, and I
can assign those colors in code as &Hrrggbb, but I don't have to, nor do I
have to use RGB().
 
D

Dennis

For some reason, when I tried that approach in 2007, it didn't like it
(grrrr). I have no idea why. But your method is far better IMO. Maybe I can
play with it some more and "convince" VBA in 2007 to like it.
 
D

Dirk Goldgar

Dennis said:
For some reason, when I tried that approach in 2007, it didn't like it
(grrrr). I have no idea why. But your method is far better IMO. Maybe I
can
play with it some more and "convince" VBA in 2007 to like it.

I dunno. I tested with Access 2007. Maybe there was something specific you
did wrong, or else I'm not understanding you.
 
D

Dennis

You may be correct about me doing something wrong. It was the first app I
tried to create in 2007, and it seemed everything I did fought me. I didn't
want to dick around for hours trying to get it to work, so I dug-up the RGB
function and that DID work, so I figured "screw it." You understood me fine;
it's MY issue that it didn't work right.
 
B

Bateman28

Hi Dennis

I have tried the code you suggested and it word, the only problem is that
when my tick box is ticked "True" the whole column within the specified field
name changes colour, is there a way in which to make it so that only the
record that the tick box is to the value of true changes colour and the
fields that are not ticked stay there original colour???

Any help would be great!

Cheers

Dennis said:
I always used the syntax that I specified in my initial reply:

"Me.myControlName.BackColor = xxxx"

where "myControlName" is the name of the control(s) that you are working
with, and (of course) "xxxx" is the color number. One thing I did notice is
that for Access 2007, I needed to use an "RGB" statement and specify the
individual color component values. I absolutely HATE doing it that way.




Bateman28 said:
Cheers for the quick reply,

are you basically saying that the code i have used is correct and to just
try and change the Spelling of colour from English to the USA spelling of
Color??

Sorry but my heads had about enough for a monday so its running alittle slow!!

Dennis said:
Me.ControlName.BackColor = xxxx

I don't believe that the Brit spelling of "colour" works, but I could be
fulla crap (wouldn't be the first time - heh)

:

Hi

I am trying to figure out how to change certain fields when a tickbox is
ticked to the value of True. My Tickbox is named WDAccessed.

I have tried the following;

Private Sub WDAccessed_Click()

If Me![WDAccessed] = True Then

Me![FullName.BackColour] = 255 Colour Red
Me![WorkDueDate.BackColour] = 255 Colour Red

Else

Me![FullName.BackColour] = -2147483643 Normal BackColour
Me![WorkDueDate.BackColour] = 2147483643 Normal BaclColour

End If
End Sub

Any help would be great.....Cheers
 

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