Setting properties son a continuous form

J

John

Hi

I have a sub form in as a continuous form. I am trying to set the colour of
a field based on value in another field like;

Private Sub Form_Current()
If IsNull(Me.FldOne) Then
Me.FldTwo.ForeColor = 0
Else
Me.FldTwo.ForeColor = 32768
End If
End Sub

The problem is that the colour of FldTwo is changed in all the records to
the value of FldOne in the record which currently ahs focus. How can I get
the colour of FldTwo based on value of FladOne in only its own record?

Thanks

Regards
 
G

Graham Mandeno

Hi John

When you set the property of a control on a continuous form it applies to
all instances of that control (in all records).

Fortunately though, you can do what you want with conditional formatting.
In design view, select the FldTwo textbox and go to Format > Conditional
Formatting. Under "Field Value 1" change "Field value is" to "Expression
is". In the next box, type:
[FldOne] Is Null
(the square brackets are important) then select the green text colour you
want from the "A" dropdown.
 
J

John

Hi Graham

Thanks. I am afraid I am using Access 97 which does not seem to have
Conditional Formatting option under Format menu.

Thanks

Regards

Graham Mandeno said:
Hi John

When you set the property of a control on a continuous form it applies to
all instances of that control (in all records).

Fortunately though, you can do what you want with conditional formatting.
In design view, select the FldTwo textbox and go to Format > Conditional
Formatting. Under "Field Value 1" change "Field value is" to "Expression
is". In the next box, type:
[FldOne] Is Null
(the square brackets are important) then select the green text colour you
want from the "A" dropdown.
--
Good Luck :)

Graham Mandeno [Access MVP]
Auckland, New Zealand

John said:
Hi

I have a sub form in as a continuous form. I am trying to set the colour
of a field based on value in another field like;

Private Sub Form_Current()
If IsNull(Me.FldOne) Then
Me.FldTwo.ForeColor = 0
Else
Me.FldTwo.ForeColor = 32768
End If
End Sub

The problem is that the colour of FldTwo is changed in all the records to
the value of FldOne in the record which currently ahs focus. How can I
get the colour of FldTwo based on value of FladOne in only its own
record?

Thanks

Regards
 

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