Re: Coding Issue
- From: "Baz" <baz@xxxxxxxxxxxxxx>
- Date: Wed, 2 Jan 2008 16:16:25 -0000
To do it based on the value already in the record you need to code the
form's Current event.
"Pierre" <Pierre@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:33EEB570-6F7B-4ECF-B4A1-AD4D3805BCD7@xxxxxxxxxxxxxxxx
Ty, that was it and for some reason I didn't see it. I remember why I
ended
up trying to change it. Once I change to a new record, that field does
not
update because the code is entered in the AFTERUPDATE property. So if I
enter Secret it will remain RED for any record I go to until I retype the
classification. (only the Overall Classification field box has this issue)
Then its a big circle if you see where I'm going with this now. So my
question now is where should I input or modify this code so that it
updates
the back color based on the text displayed or entered.
--
Work is sometimes hard....but someone has to do it.
"Baz" wrote:
Yep, gotcha.
The problem is that there is nothing in the code to change the background
colour of [Overall Classification]. You must have accidentally deleted
it
or overtyped it. Try this:
Private Sub Overall_Classification_AfterUpdate()
If InStr(Me.[Overall Classification], "SECRET") = 1 Then
IngColor = 255
ElseIf InStr (Me.[Overall Classification], "TS" = 1 Then
IngColor = 65535
Else
IngColor = 0
End If
For InVal = 220 To 240 Step 2
Me.Controls("Text" & IntVal).BackColor = IngColor
Me.Controls("Text" & IntVal).Value = Me.[Overall Classification]
Next
Me.[Overall Classification].BackColor = IngColor
End Sub
"Pierre" <Pierre@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:F13445FF-F424-430C-9972-AB68B7A23C3F@xxxxxxxxxxxxxxxx
It does not have to change while the information is being type. But
what
I
was trying to say is that its not changing at all. It remains with a
white
back color regardless of what I put in. All others are changing based
on
the
set WORDS entered in the [Overall Classification] field. But the
[Overall
Classification] entry field is not changing as it was when I first
started.
I made some change to try to get the other fields to work. And really
can't
figure out what I did to make it stop working. Hope that cleared my
intent
up better.
--
Work is sometimes hard....but someone has to do it.
"Baz" wrote:
If I understand you correctly you want the code to be executed while
someone
is still typing in the box, is that right?
As you have discovered, the AfterUpdate event only executes after the
typing
is finished. To run the code as each letter is typed, the Change
event
or
the KeyDown event of [Overall Classification] is probably the best
place
to
put it. Make sure you refer explicity to the Text property, thus:
If InStr(Me.[Overall Classification].Text, "SECRET") = 1 Then
"Pierre" <Pierre@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:9A30FD82-E728-4C5B-A02D-E7FB7DB5B91B@xxxxxxxxxxxxxxxx
Baz that was very helpful and worked like a cherm.
I have another code that was working at one point. But stop working
after
I
was trying to fix the one I just spoke about. Is it possible to
view
this
and inform me to what I did (changed) wrong. It is suppose to
change
as
text
is entered or based on the text in the box. Similar to the others,
excite
this is the box where the initial Classification is being entered.
Hope
that
made sense. Here is the Code:
Private Sub Overall_Classification_AfterUpdate()
If InStr(Me.[Overall Classification], "SECRET") = 1 Then
IngColor = 255
ElseIf InStr (Me.[Overall Classification], "TS" = 1 Then
IngColor = 65535
Else
IngColor = 0
End If
For InVal = 220 To 240 Step 2
Me.Controls("Text" & IntVal).BackColor = IngColor
Me.Controls("Text" & IntVal).Value = Me.[Overall Classification]
Next
End Sub
.
- Follow-Ups:
- Re: Coding Issue
- From: Pierre
- Re: Coding Issue
- References:
- Re: Coding Issue
- From: Baz
- Re: Coding Issue
- From: Baz
- Re: Coding Issue
- From: Pierre
- Re: Coding Issue
- From: Baz
- Re: Coding Issue
- From: Pierre
- Re: Coding Issue
- Prev by Date: Re: Date() at fiscal year
- Next by Date: auto post data to web form
- Previous by thread: Re: Coding Issue
- Next by thread: Re: Coding Issue
- Index(es):
Relevant Pages
|