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
 
T

tom_willpa

high quality Soccer jerseys NBA Jersey tracksuit and jackets, GHD
hairstraightener supplier from www.willpa.com

Are you a Retail businessman who bother by the purchase price? China
Cheapest TOP wholesale website can help you

we are specialize in replica sport goods manufacturing in china, we can
offer you all kinds of soccer jersey, NBA jersey,shoes and so on. they are
the best brand replica goods whih are look the same as the original goods.
excellent quality and steady supply for them. we have been marketed in Europe
and American for 3 year. all the goods we offer are AAA quality. our soccer
jersey are Thailand style. If any goods you buy from my company have problem,
we will refund or resend them again. Most of ourProducts have no minimum
order requirements,soyou can shop retail goods at wholesale prices. if you
can buy more than 300usd. We offer free shipping. The more you buy the more
discount for you.

National soccer jerseys: http://www.willpa.com
Club soccer jerseys: http://www.willpa.com
NBA Jerseys: http://www.willpa.com
T-shirt and shirt: http://www.willpa.com
Tracksuit: http://www.willpa.com
Hoody & Jackets: http://www.willpa.com
UGG boots: http://www.willpa.com
Hair style: http://www.willpa.com
shopping Index: http://www.willpa.com

EMS shipping. 7days arrive, paypal accept

want more information pls contact us or check our website: www.willpa.com
 

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