alter properties of subForm control (KBase Article 209099]

G

Guest

i have two forms, the main form and its subform. the
subform is being displayed as a continuous datasheet (oh
yeah and btw i am using A2K), and i want the color of
the 'Time_on_List' subForm control to change from black text on
white bkgrnd to yellow text on red whenever its value is
= 30 AND the value of an adjacent 'Outcome' control on the same
subform's equal to "Pending". [yes, i do know about simple conditional
formatting (e.g. i've conditionally set the value of "Pending" in the
'Outcome' control to be displayed in Yellow w/ a Red background) but this
condition revolves around more than one control's values]

for some reason the same VBA code works on other forms (in
Form view) which are not subforms but are viewed by the
user as a main form but it has no effect on the same
control when applied in the context i've just described.

my code is below, can you point to some obvious glitch?

Private Sub Form_Current()
Dim lngRed As Long, lngYellog As Long, lngWhite As Long,
Time_on_List As Integer

lngRed = RGB(255, 0, 0)
lngBlack = RGB(0, 0, 0)
lngYellow = RGB(255, 255, 0)
lngWhite = RGB(255, 255, 255)

Me.Time_on_List = DateDiff("d", Me.Date_on_List, Now())
If Me.Time_on_List >= 30 And Me.Outcome = "Pending" Then
Me.Time_on_List.ForeColor = lngYellow
Me.Time_on_List.BackColor = lngRed
Else
Me.Time_on_List.ForeColor = lngBlack
Me.Time_on_List.BackColor = lngWhite
End If
End Sub

i tried referencing the names of the controls above using the long-winded
syntax found in KBase Article 209099 but encounter run time errors about
a2k's not finding the named form(s)????

anyone out there run 'cross this interested in chiming in?
 
G

Geof Wyght

Ted,
Try:
Me.Controls("subform name in parent").Form.Controls
("Time_on_List").ForeColor = lngYellow

Geof.
-----Original Message-----
i have two forms, the main form and its subform. the
subform is being displayed as a continuous datasheet (oh
yeah and btw i am using A2K), and i want the color of
the 'Time_on_List' subForm control to change from black text on
white bkgrnd to yellow text on red whenever its value is
= 30 AND the value of an adjacent 'Outcome' control on
the same
subform's equal to "Pending". [yes, i do know about simple conditional
formatting (e.g. i've conditionally set the value of "Pending" in the
'Outcome' control to be displayed in Yellow w/ a Red background) but this
condition revolves around more than one control's values]

for some reason the same VBA code works on other forms (in
Form view) which are not subforms but are viewed by the
user as a main form but it has no effect on the same
control when applied in the context i've just described.

my code is below, can you point to some obvious glitch?

Private Sub Form_Current()
Dim lngRed As Long, lngYellog As Long, lngWhite As Long,
Time_on_List As Integer

lngRed = RGB(255, 0, 0)
lngBlack = RGB(0, 0, 0)
lngYellow = RGB(255, 255, 0)
lngWhite = RGB(255, 255, 255)

Me.Time_on_List = DateDiff("d", Me.Date_on_List, Now())
If Me.Time_on_List >= 30 And Me.Outcome = "Pending" Then
Me.Time_on_List.ForeColor = lngYellow
Me.Time_on_List.BackColor = lngRed
Else
Me.Time_on_List.ForeColor = lngBlack
Me.Time_on_List.BackColor = lngWhite
End If
End Sub

i tried referencing the names of the controls above using the long-winded
syntax found in KBase Article 209099 but encounter run time errors about
a2k's not finding the named form(s)????

anyone out there run 'cross this interested in chiming in?

.
 
G

Guest

hi geoff!

i'm getting an error 2465 about "Oncology Screening Log can't find the field
'DataSheet View of Screen' referred to in your expression".

i'v pasted the code i'm using to tick it off below:)

Private Sub Form_Current()
Dim lngRed As Long, lngYellog As Long, lngWhite As Long, Time_on_List As
Integer

lngRed = RGB(255, 0, 0)
lngBlack = RGB(0, 0, 0)
lngYellow = RGB(255, 255, 0)
lngWhite = RGB(255, 255, 255)

Me.Controls("DataSheet View of Screen").Form.Controls("Time_on_List") =
DateDiff("d", Me.Controls("DataSheet View of
Screen").Form.Controls("Date_on_List"), Now())

If Me.Controls("DataSheet View of Screen").Form.Controls("Time_on_List") >=
30 And Me.Outcome = "Pending" Then
Me.Controls("DataSheet View of
Screen").Form.Controls("Time_on_List").ForeColor = lngYellow
Me.Controls("DataSheet View of
Screen").Form.Controls("Time_on_List").BackColor = lngRed
Else
Me.Controls("DataSheet View of
Screen").Form.Controls("Time_on_List").ForeColor = lngBlack
Me.Controls("DataSheet View of
Screen").Form.Controls("Time_on_List").BackColor = lngWhite
End If

End Sub


Geof Wyght said:
Ted,
Try:
Me.Controls("subform name in parent").Form.Controls
("Time_on_List").ForeColor = lngYellow

Geof.
-----Original Message-----
i have two forms, the main form and its subform. the
subform is being displayed as a continuous datasheet (oh
yeah and btw i am using A2K), and i want the color of
the 'Time_on_List' subForm control to change from black text on
white bkgrnd to yellow text on red whenever its value is
= 30 AND the value of an adjacent 'Outcome' control on
the same
subform's equal to "Pending". [yes, i do know about simple conditional
formatting (e.g. i've conditionally set the value of "Pending" in the
'Outcome' control to be displayed in Yellow w/ a Red background) but this
condition revolves around more than one control's values]

for some reason the same VBA code works on other forms (in
Form view) which are not subforms but are viewed by the
user as a main form but it has no effect on the same
control when applied in the context i've just described.

my code is below, can you point to some obvious glitch?

Private Sub Form_Current()
Dim lngRed As Long, lngYellog As Long, lngWhite As Long,
Time_on_List As Integer

lngRed = RGB(255, 0, 0)
lngBlack = RGB(0, 0, 0)
lngYellow = RGB(255, 255, 0)
lngWhite = RGB(255, 255, 255)

Me.Time_on_List = DateDiff("d", Me.Date_on_List, Now())
If Me.Time_on_List >= 30 And Me.Outcome = "Pending" Then
Me.Time_on_List.ForeColor = lngYellow
Me.Time_on_List.BackColor = lngRed
Else
Me.Time_on_List.ForeColor = lngBlack
Me.Time_on_List.BackColor = lngWhite
End If
End Sub

i tried referencing the names of the controls above using the long-winded
syntax found in KBase Article 209099 but encounter run time errors about
a2k's not finding the named form(s)????

anyone out there run 'cross this interested in chiming in?

.
 
G

Guest

geoff, although i seem to have erred initially in understanding your phras
"subform name in parent") and replaced the reference to parent form's name
with the name of the subform's (see code below), the message/error about
error 2465 and ms not being able to find the form named "Screening Log (DS
View)" is basically singing the same tune as the last one's.

Private Sub Form_Current()
Dim lngRed As Long, lngYellog As Long, lngWhite As Long, Time_on_List As
Integer

lngRed = RGB(255, 0, 0)
lngBlack = RGB(0, 0, 0)
lngYellow = RGB(255, 255, 0)
lngWhite = RGB(255, 255, 255)

Me.Controls("Screening Log (DS View)").Form.Controls("Time_on_List") =
DateDiff("d", Me.Controls("Screening Log (DS
View)").Form.Controls("Date_on_List"), Now())

If Me.Controls("Screening Log (DS View)").Form.Controls("Time_on_List") >=
30 And Me.Outcome = "Pending" Then
Me.Controls("Screening Log (DS
View)").Form.Controls("Time_on_List").ForeColor = lngYellow
Me.Controls("Screening Log (DS
View)").Form.Controls("Time_on_List").BackColor = lngRed
Else
Me.Controls("Screening Log (DS
View)").Form.Controls("Time_on_List").ForeColor = lngBlack
Me.Controls("Screening Log (DS
View)").Form.Controls("Time_on_List").BackColor = lngWhite
End If

End Sub


Geof Wyght said:
Ted,
Try:
Me.Controls("subform name in parent").Form.Controls
("Time_on_List").ForeColor = lngYellow

Geof.
-----Original Message-----
i have two forms, the main form and its subform. the
subform is being displayed as a continuous datasheet (oh
yeah and btw i am using A2K), and i want the color of
the 'Time_on_List' subForm control to change from black text on
white bkgrnd to yellow text on red whenever its value is
= 30 AND the value of an adjacent 'Outcome' control on
the same
subform's equal to "Pending". [yes, i do know about simple conditional
formatting (e.g. i've conditionally set the value of "Pending" in the
'Outcome' control to be displayed in Yellow w/ a Red background) but this
condition revolves around more than one control's values]

for some reason the same VBA code works on other forms (in
Form view) which are not subforms but are viewed by the
user as a main form but it has no effect on the same
control when applied in the context i've just described.

my code is below, can you point to some obvious glitch?

Private Sub Form_Current()
Dim lngRed As Long, lngYellog As Long, lngWhite As Long,
Time_on_List As Integer

lngRed = RGB(255, 0, 0)
lngBlack = RGB(0, 0, 0)
lngYellow = RGB(255, 255, 0)
lngWhite = RGB(255, 255, 255)

Me.Time_on_List = DateDiff("d", Me.Date_on_List, Now())
If Me.Time_on_List >= 30 And Me.Outcome = "Pending" Then
Me.Time_on_List.ForeColor = lngYellow
Me.Time_on_List.BackColor = lngRed
Else
Me.Time_on_List.ForeColor = lngBlack
Me.Time_on_List.BackColor = lngWhite
End If
End Sub

i tried referencing the names of the controls above using the long-winded
syntax found in KBase Article 209099 but encounter run time errors about
a2k's not finding the named form(s)????

anyone out there run 'cross this interested in chiming in?

.
 
G

Geof Wyght

Ted,
I was able to reproduce the code in your first reply. Have
a look at:
http://home.fuse.net/Wyght/db2.mdb
Geof.
PS: I made a button because my form wasn't bound.
-----Original Message-----
geoff, although i seem to have erred initially in understanding your phras
"subform name in parent") and replaced the reference to parent form's name
with the name of the subform's (see code below), the message/error about
error 2465 and ms not being able to find the form named "Screening Log (DS
View)" is basically singing the same tune as the last one's.

Private Sub Form_Current()
Dim lngRed As Long, lngYellog As Long, lngWhite As Long, Time_on_List As
Integer

lngRed = RGB(255, 0, 0)
lngBlack = RGB(0, 0, 0)
lngYellow = RGB(255, 255, 0)
lngWhite = RGB(255, 255, 255)

Me.Controls("Screening Log (DS View)").Form.Controls ("Time_on_List") =
DateDiff("d", Me.Controls("Screening Log (DS
View)").Form.Controls("Date_on_List"), Now())

If Me.Controls("Screening Log (DS View)").Form.Controls ("Time_on_List") >=
30 And Me.Outcome = "Pending" Then
Me.Controls("Screening Log (DS
View)").Form.Controls("Time_on_List").ForeColor = lngYellow
Me.Controls("Screening Log (DS
View)").Form.Controls("Time_on_List").BackColor = lngRed
Else
Me.Controls("Screening Log (DS
View)").Form.Controls("Time_on_List").ForeColor = lngBlack
Me.Controls("Screening Log (DS
View)").Form.Controls("Time_on_List").BackColor = lngWhite
End If

End Sub


Geof Wyght said:
Ted,
Try:
Me.Controls("subform name in parent").Form.Controls
("Time_on_List").ForeColor = lngYellow

Geof.
-----Original Message-----
i have two forms, the main form and its subform. the
subform is being displayed as a continuous datasheet (oh
yeah and btw i am using A2K), and i want the color of
the 'Time_on_List' subForm control to change from
black
text on
white bkgrnd to yellow text on red whenever its value is
= 30 AND the value of an adjacent 'Outcome' control
on
the same
subform's equal to "Pending". [yes, i do know about simple conditional
formatting (e.g. i've conditionally set the value of "Pending" in the
'Outcome' control to be displayed in Yellow w/ a Red background) but this
condition revolves around more than one control's values]

for some reason the same VBA code works on other forms (in
Form view) which are not subforms but are viewed by the
user as a main form but it has no effect on the same
control when applied in the context i've just described.

my code is below, can you point to some obvious glitch?

Private Sub Form_Current()
Dim lngRed As Long, lngYellog As Long, lngWhite As Long,
Time_on_List As Integer

lngRed = RGB(255, 0, 0)
lngBlack = RGB(0, 0, 0)
lngYellow = RGB(255, 255, 0)
lngWhite = RGB(255, 255, 255)

Me.Time_on_List = DateDiff("d", Me.Date_on_List, Now())
If Me.Time_on_List >= 30 And Me.Outcome = "Pending" Then
Me.Time_on_List.ForeColor = lngYellow
Me.Time_on_List.BackColor = lngRed
Else
Me.Time_on_List.ForeColor = lngBlack
Me.Time_on_List.BackColor = lngWhite
End If
End Sub

i tried referencing the names of the controls above
using
the long-winded
syntax found in KBase Article 209099 but encounter run time errors about
a2k's not finding the named form(s)????

anyone out there run 'cross this interested in chiming in?

.
.
 
G

Guest

hi geoff,

thanks for the example but i'm not sure a) i know what it's supposed to
prove and b) that it works (or that i know how to demonstrate some underlying
principle).

allow me to clarify the weird form names i use: "DataSheet View of Screen"
is the name given to a 'parent form' which has nothing else on it but the
sub-form (now) called "Screening Log DS View" (confusing isn't it) which i
renamed to remove the (possibly offending) parentheses -- who knows what
these compilers want !!

at any rate, the following line:

Me.Controls("Screening Log DS View").Form.Controls("Time_on_List").ForeColor
= lngBlack

is getting the yellow bar (error) treatment by the vba when i open the msg
window and try to 'debug' it.....

at any rate,

Geof Wyght said:
Ted,
I was able to reproduce the code in your first reply. Have
a look at:
http://home.fuse.net/Wyght/db2.mdb
Geof.
PS: I made a button because my form wasn't bound.
-----Original Message-----
geoff, although i seem to have erred initially in understanding your phras
"subform name in parent") and replaced the reference to parent form's name
with the name of the subform's (see code below), the message/error about
error 2465 and ms not being able to find the form named "Screening Log (DS
View)" is basically singing the same tune as the last one's.

Private Sub Form_Current()
Dim lngRed As Long, lngYellog As Long, lngWhite As Long, Time_on_List As
Integer

lngRed = RGB(255, 0, 0)
lngBlack = RGB(0, 0, 0)
lngYellow = RGB(255, 255, 0)
lngWhite = RGB(255, 255, 255)

Me.Controls("Screening Log (DS View)").Form.Controls ("Time_on_List") =
DateDiff("d", Me.Controls("Screening Log (DS
View)").Form.Controls("Date_on_List"), Now())

If Me.Controls("Screening Log (DS View)").Form.Controls ("Time_on_List") >=
30 And Me.Outcome = "Pending" Then
Me.Controls("Screening Log (DS
View)").Form.Controls("Time_on_List").ForeColor = lngYellow
Me.Controls("Screening Log (DS
View)").Form.Controls("Time_on_List").BackColor = lngRed
Else
Me.Controls("Screening Log (DS
View)").Form.Controls("Time_on_List").ForeColor = lngBlack
Me.Controls("Screening Log (DS
View)").Form.Controls("Time_on_List").BackColor = lngWhite
End If

End Sub


Geof Wyght said:
Ted,
Try:
Me.Controls("subform name in parent").Form.Controls
("Time_on_List").ForeColor = lngYellow

Geof.
-----Original Message-----
i have two forms, the main form and its subform. the
subform is being displayed as a continuous datasheet (oh
yeah and btw i am using A2K), and i want the color of
the 'Time_on_List' subForm control to change from black
text on
white bkgrnd to yellow text on red whenever its value is
= 30 AND the value of an adjacent 'Outcome' control on
the same
subform's equal to "Pending". [yes, i do know about
simple conditional
formatting (e.g. i've conditionally set the value
of "Pending" in the
'Outcome' control to be displayed in Yellow w/ a Red
background) but this
condition revolves around more than one control's values]

for some reason the same VBA code works on other forms
(in
Form view) which are not subforms but are viewed by the
user as a main form but it has no effect on the same
control when applied in the context i've just described.

my code is below, can you point to some obvious glitch?

Private Sub Form_Current()
Dim lngRed As Long, lngYellog As Long, lngWhite As Long,
Time_on_List As Integer

lngRed = RGB(255, 0, 0)
lngBlack = RGB(0, 0, 0)
lngYellow = RGB(255, 255, 0)
lngWhite = RGB(255, 255, 255)

Me.Time_on_List = DateDiff("d", Me.Date_on_List, Now())
If Me.Time_on_List >= 30 And Me.Outcome = "Pending" Then
Me.Time_on_List.ForeColor = lngYellow
Me.Time_on_List.BackColor = lngRed
Else
Me.Time_on_List.ForeColor = lngBlack
Me.Time_on_List.BackColor = lngWhite
End If
End Sub

i tried referencing the names of the controls above using
the long-winded
syntax found in KBase Article 209099 but encounter run
time errors about
a2k's not finding the named form(s)????

anyone out there run 'cross this interested in chiming in?

.
.
 
G

Guest

geoff,

it's me 'gain :)

okay, i tried to play with your app'n and agreed, if i drop the word
'Pending' into the parent field's control and the date 10/01/02 into the
'Date_on_List' field and click the button, the 'Time_on_List' is computed as
738 or something and the field changes colors!!

but why won't this all work for me .... i wonder if it's because there are
some differences in the basic layouts. all my data is on the sub-form (no
data or controls like buttons etc etc on the parent form) and i'm trying to
get this to work in an 'On Current' event property?



Geof Wyght said:
Ted,
I was able to reproduce the code in your first reply. Have
a look at:
http://home.fuse.net/Wyght/db2.mdb
Geof.
PS: I made a button because my form wasn't bound.
-----Original Message-----
geoff, although i seem to have erred initially in understanding your phras
"subform name in parent") and replaced the reference to parent form's name
with the name of the subform's (see code below), the message/error about
error 2465 and ms not being able to find the form named "Screening Log (DS
View)" is basically singing the same tune as the last one's.

Private Sub Form_Current()
Dim lngRed As Long, lngYellog As Long, lngWhite As Long, Time_on_List As
Integer

lngRed = RGB(255, 0, 0)
lngBlack = RGB(0, 0, 0)
lngYellow = RGB(255, 255, 0)
lngWhite = RGB(255, 255, 255)

Me.Controls("Screening Log (DS View)").Form.Controls ("Time_on_List") =
DateDiff("d", Me.Controls("Screening Log (DS
View)").Form.Controls("Date_on_List"), Now())

If Me.Controls("Screening Log (DS View)").Form.Controls ("Time_on_List") >=
30 And Me.Outcome = "Pending" Then
Me.Controls("Screening Log (DS
View)").Form.Controls("Time_on_List").ForeColor = lngYellow
Me.Controls("Screening Log (DS
View)").Form.Controls("Time_on_List").BackColor = lngRed
Else
Me.Controls("Screening Log (DS
View)").Form.Controls("Time_on_List").ForeColor = lngBlack
Me.Controls("Screening Log (DS
View)").Form.Controls("Time_on_List").BackColor = lngWhite
End If

End Sub


Geof Wyght said:
Ted,
Try:
Me.Controls("subform name in parent").Form.Controls
("Time_on_List").ForeColor = lngYellow

Geof.
-----Original Message-----
i have two forms, the main form and its subform. the
subform is being displayed as a continuous datasheet (oh
yeah and btw i am using A2K), and i want the color of
the 'Time_on_List' subForm control to change from black
text on
white bkgrnd to yellow text on red whenever its value is
= 30 AND the value of an adjacent 'Outcome' control on
the same
subform's equal to "Pending". [yes, i do know about
simple conditional
formatting (e.g. i've conditionally set the value
of "Pending" in the
'Outcome' control to be displayed in Yellow w/ a Red
background) but this
condition revolves around more than one control's values]

for some reason the same VBA code works on other forms
(in
Form view) which are not subforms but are viewed by the
user as a main form but it has no effect on the same
control when applied in the context i've just described.

my code is below, can you point to some obvious glitch?

Private Sub Form_Current()
Dim lngRed As Long, lngYellog As Long, lngWhite As Long,
Time_on_List As Integer

lngRed = RGB(255, 0, 0)
lngBlack = RGB(0, 0, 0)
lngYellow = RGB(255, 255, 0)
lngWhite = RGB(255, 255, 255)

Me.Time_on_List = DateDiff("d", Me.Date_on_List, Now())
If Me.Time_on_List >= 30 And Me.Outcome = "Pending" Then
Me.Time_on_List.ForeColor = lngYellow
Me.Time_on_List.BackColor = lngRed
Else
Me.Time_on_List.ForeColor = lngBlack
Me.Time_on_List.BackColor = lngWhite
End If
End Sub

i tried referencing the names of the controls above using
the long-winded
syntax found in KBase Article 209099 but encounter run
time errors about
a2k's not finding the named form(s)????

anyone out there run 'cross this interested in chiming in?

.
.
 
G

Geof Wyght

Ted,
In your first set of code, lngBlack was not declared.
Sorry for lack of instructions for db2.mdb. I put it back
out there with your form name design. Open the "DataSheet
View of Screen" form. Enter "pending" in the Text3 text
box. Enter 12/31/2003 in the Date on Lust text box, then
click the button. This demonstrates that the code works,
the formating works, ...
Geof.
-----Original Message-----
hi geoff,

thanks for the example but i'm not sure a) i know what it's supposed to
prove and b) that it works (or that i know how to demonstrate some underlying
principle).

allow me to clarify the weird form names i
use: "DataSheet View of Screen"
is the name given to a 'parent form' which has nothing else on it but the
sub-form (now) called "Screening Log DS View" (confusing isn't it) which i
renamed to remove the (possibly offending) parentheses -- who knows what
these compilers want !!

at any rate, the following line:

Me.Controls("Screening Log DS View").Form.Controls ("Time_on_List").ForeColor
= lngBlack

is getting the yellow bar (error) treatment by the vba when i open the msg
window and try to 'debug' it.....

at any rate,

Geof Wyght said:
Ted,
I was able to reproduce the code in your first reply. Have
a look at:
http://home.fuse.net/Wyght/db2.mdb
Geof.
PS: I made a button because my form wasn't bound.
-----Original Message-----
geoff, although i seem to have erred initially in understanding your phras
"subform name in parent") and replaced the reference
to
parent form's name
with the name of the subform's (see code below), the message/error about
error 2465 and ms not being able to find the form named "Screening Log (DS
View)" is basically singing the same tune as the last one's.

Private Sub Form_Current()
Dim lngRed As Long, lngYellog As Long, lngWhite As
Long,
Time_on_List As
Integer

lngRed = RGB(255, 0, 0)
lngBlack = RGB(0, 0, 0)
lngYellow = RGB(255, 255, 0)
lngWhite = RGB(255, 255, 255)

Me.Controls("Screening Log (DS View)").Form.Controls ("Time_on_List") =
DateDiff("d", Me.Controls("Screening Log (DS
View)").Form.Controls("Date_on_List"), Now())

If Me.Controls("Screening Log (DS
View)").Form.Controls
("Time_on_List") >=
30 And Me.Outcome = "Pending" Then
Me.Controls("Screening Log (DS
View)").Form.Controls("Time_on_List").ForeColor = lngYellow
Me.Controls("Screening Log (DS
View)").Form.Controls("Time_on_List").BackColor = lngRed
Else
Me.Controls("Screening Log (DS
View)").Form.Controls("Time_on_List").ForeColor = lngBlack
Me.Controls("Screening Log (DS
View)").Form.Controls("Time_on_List").BackColor = lngWhite
End If

End Sub


:

Ted,
Try:
Me.Controls("subform name in parent").Form.Controls
("Time_on_List").ForeColor = lngYellow

Geof.
-----Original Message-----
i have two forms, the main form and its subform. the
subform is being displayed as a continuous
datasheet
(oh
yeah and btw i am using A2K), and i want the color of
the 'Time_on_List' subForm control to change from black
text on
white bkgrnd to yellow text on red whenever its
value
is
= 30 AND the value of an adjacent 'Outcome'
control
on
the same
subform's equal to "Pending". [yes, i do know about
simple conditional
formatting (e.g. i've conditionally set the value
of "Pending" in the
'Outcome' control to be displayed in Yellow w/ a Red
background) but this
condition revolves around more than one control's values]

for some reason the same VBA code works on other forms
(in
Form view) which are not subforms but are viewed by the
user as a main form but it has no effect on the same
control when applied in the context i've just described.

my code is below, can you point to some obvious glitch?

Private Sub Form_Current()
Dim lngRed As Long, lngYellog As Long, lngWhite As Long,
Time_on_List As Integer

lngRed = RGB(255, 0, 0)
lngBlack = RGB(0, 0, 0)
lngYellow = RGB(255, 255, 0)
lngWhite = RGB(255, 255, 255)

Me.Time_on_List = DateDiff("d", Me.Date_on_List, Now ())
If Me.Time_on_List >= 30 And Me.Outcome
= "Pending"
Then
Me.Time_on_List.ForeColor = lngYellow
Me.Time_on_List.BackColor = lngRed
Else
Me.Time_on_List.ForeColor = lngBlack
Me.Time_on_List.BackColor = lngWhite
End If
End Sub

i tried referencing the names of the controls above using
the long-winded
syntax found in KBase Article 209099 but encounter run
time errors about
a2k's not finding the named form(s)????

anyone out there run 'cross this interested in
chiming
in?
.
 
G

Guest

hi geoff,

i hate to inundate you with all of this....

i moved your parent control to the subform on your app'n and fleshed out the
fact that it'd been moved into the code by using the longwinded path (i
realized why put it on the parent when i saw that i'n not referenced any path
to the Outcome control) and found that the button worked as before. then i
copied the vba from the click event to the 'On Current' event of the
subform's and immediately began to get this 2465 error message about it not
being able tofind the 'DataSheet of Screen' referred to in your expression :)

Ted said:
i have two forms, the main form and its subform. the
subform is being displayed as a continuous datasheet (oh
yeah and btw i am using A2K), and i want the color of
the 'Time_on_List' subForm control to change from black text on
white bkgrnd to yellow text on red whenever its value is
= 30 AND the value of an adjacent 'Outcome' control on the same
subform's equal to "Pending". [yes, i do know about simple conditional
formatting (e.g. i've conditionally set the value of "Pending" in the
'Outcome' control to be displayed in Yellow w/ a Red background) but this
condition revolves around more than one control's values]

for some reason the same VBA code works on other forms (in
Form view) which are not subforms but are viewed by the
user as a main form but it has no effect on the same
control when applied in the context i've just described.

my code is below, can you point to some obvious glitch?

Private Sub Form_Current()
Dim lngRed As Long, lngYellog As Long, lngWhite As Long,
Time_on_List As Integer

lngRed = RGB(255, 0, 0)
lngBlack = RGB(0, 0, 0)
lngYellow = RGB(255, 255, 0)
lngWhite = RGB(255, 255, 255)

Me.Time_on_List = DateDiff("d", Me.Date_on_List, Now())
If Me.Time_on_List >= 30 And Me.Outcome = "Pending" Then
Me.Time_on_List.ForeColor = lngYellow
Me.Time_on_List.BackColor = lngRed
Else
Me.Time_on_List.ForeColor = lngBlack
Me.Time_on_List.BackColor = lngWhite
End If
End Sub

i tried referencing the names of the controls above using the long-winded
syntax found in KBase Article 209099 but encounter run time errors about
a2k's not finding the named form(s)????

anyone out there run 'cross this interested in chiming in?
 

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