|
-
Jun 27th, 2006, 05:38 AM
#1
Thread Starter
New Member
URGENT Change Background color in Continuous form
Can anybody please help????
I have a continuous sub form where I'm trying to change the background
colour of a text box called "Debriefed"
if the criteria is YES then I want the control to be GREEN
and RED if the criteria is NO
The code I have below works if I set the form to a single form however
it dosen't work if I set it to continuous
Private Sub Form_Current()
If [Debriefed] = "Yes" Then
[Debriefed].BackColor = vbGreen
Else
[Debriefed].BackColor = vbRed
End If
End Sub
Many thanks in advance
-
Jun 27th, 2006, 06:42 AM
#2
Addicted Member
Re: URGENT Change Background color in Continuous form
What do you mean by "continuous"?
-
Jun 27th, 2006, 07:00 AM
#3
Frenzied Member
Re: URGENT Change Background color in Continuous form
Look at my post #8 in this link.
Basically you want conditional formatting.
Tengo mas preguntas que contestas
-
Jun 28th, 2006, 03:58 AM
#4
Thread Starter
New Member
Re: URGENT Change Background color in Continuous form
by continuous I meant changing the sub form to a continuous form
instead of a single form
the code works in single sub form but not on a continuous sub form
-
Jun 29th, 2006, 05:51 AM
#5
Thread Starter
New Member
Re: URGENT Change Background color in Continuous form
Hi salvelinus
You link was just the job...however Im only a beginner and I didn't really understand the language in the modules etc
is there a easier way to obtain the code I require
as I can get my current vba code to work on a single form but when it is a continuous form it dosent work
hope you can hope
the code i currently have is
Private Sub Form_Current()
If [Debriefed] = "Yes" Then
[Debriefed].BackColor = vbGreen
Else
[Debriefed].BackColor = vbRed
End If
End Sub
-
Jun 29th, 2006, 10:12 AM
#6
Frenzied Member
Re: URGENT Change Background color in Continuous form
I don't think you have to use code (although you could). You can do the conditional formatting from the Format > Conditional Formatting Menu when you have the form in Design view with the textbox selected.
For Condition 1 select Field value is, then in the next combobox select is equal to, in the last combobox enter "Yes", then click the paint bucket and select green.
Next click Add to bring up Condition 2, repeat the process for "No", selecting red.
Yes & No must be in quotes in the Conditional Formatting box, but that isn't necessary for the text box.
HTH.
Tengo mas preguntas que contestas
-
Jun 30th, 2006, 01:31 AM
#7
Thread Starter
New Member
Re: URGENT Change Background color in Continuous form
Thank you for your reply salvelinus.... the only problem I have is that I'm unfortunately using Access 97
Do you know of another way
Many thanks in advance
C
-
Jun 30th, 2006, 06:35 AM
#8
Re: URGENT Change Background color in Continuous form
create an image in the continous part, put to the back and make sure its data bit says red or green (the image name)
I think it is something like that - therefore the form recreates an image for each detail.
Other methods don't work
It is crap method for displaying anyway - perhaps look for a control you can use?
Feeling like a fly on the inside of a closed window (Thunk!)
If I post a lot, it is because I am bored at work! ;D Or stuck...
* Anything I post can be only my opinion. Advice etc is up to you to persue...
-
Jun 30th, 2006, 07:17 AM
#9
Frenzied Member
Re: URGENT Change Background color in Continuous form
Sorry, don't know about Access 97. Do you have to use a textbox for user entry, or can you use a label? Might be easier to set color with that.
Tengo mas preguntas que contestas
-
Jun 30th, 2006, 09:18 AM
#10
Re: URGENT Change Background color in Continuous form
salvelinus:
Picture a form design layout of controls.
Now for each record picture the same controls repeated under each other (grouped by record).
Then picture for some value in a control the background changes from green to red.
fairly nice visually - at least whilst you are learning, but not good for proper dbs... imo
Feeling like a fly on the inside of a closed window (Thunk!)
If I post a lot, it is because I am bored at work! ;D Or stuck...
* Anything I post can be only my opinion. Advice etc is up to you to persue...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|