1) yes i did
2) ditto
geoff -- i think this software's having an 'issue' with restpect to the fact
that in my own app'n i have all the controls on one subForm; in yours, you
deposited the 'Outcome' control onto the main/parent form and (i guess since)
your fields were unbound (deposited a button onto the main one).
in my app'n (with the lngBlack correction), i have all my controls bound to
a table behind the form with table names that are the same as the controls'
and i have the code in an 'On Event' property.
so when you referenced the Outcome control in your 2nd db, i would guess it
correctly pointed to the fact it was sitting on the main form (your code's
below):
Option Compare Database
Option Explicit
Private Sub Command5_Click()
Dim lngRed As Long
Dim lngYellow As Long
Dim lngWhite As Long
Dim lngBlack As Long
Dim 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
SO, when it sees "Me.Outcome = "Pending"" it 'knows' to get if from the same
form the button's on.
this is all reasoned conjecture from a VBA 'newbie' but i am reckoning that
when this code shows up in an 'On Event' property of the subForm we need to
'tell' VBA where the 'Outcome' control's sitting and that it's on the same
subForm as all the other controls.
i'm trying to morph your app'n into a miniature of the full-blown one i am
cobbling together. so, i'm creating a table with three fields which will be
my data source for the bound controls on the sub-form. i'm removing the
Outcome field from the parent form and knocking off the command button. so
far, i still seem to be ticking off the compiler :-(
i'd love to see what happens on your end...
ted