Group:  Microsoft Access ยป microsoft.public.access.formscoding
Thread: Field Color not changing using Conditional Format or On Not In Lis

Geek News

Field Color not changing using Conditional Format or On Not In Lis
RAN 12/2/2008 9:07:01 PM
I've got a single form with a combo box field ([Combo_NSFCertified]) whose
control source is a field from a table. When the form is opened I want the
field background to be colored red if the value of the field is not one of
the acceptable values from the combo list. I've created a hidden text field
([NSF_Certified_Unmatched]) from an unmatched query, which compares the value
to the accepable list. I've tried using conditional formatting with
Expression Is [Combo_NSFCertified]=[NSF_Certified_Unmatched], but this isn't
working.

I've also tried using the On Not in List with the following code:
Private Sub Combo_NSFCertified_NotInList(NewData As String, Response As
Integer)
Me!Combo_NSFCertified.BackColor = vbRed
End Sub
This doesn't work either. Please help. Thanks.
Re: Field Color not changing using Conditional Format or On Not In Lis
Marshall Barton <marshbarton[ at ]wowway.com> 12/2/2008 11:05:04 PM
RAN wrote:

[Quoted Text]
>I've got a single form with a combo box field ([Combo_NSFCertified]) whose
>control source is a field from a table. When the form is opened I want the
>field background to be colored red if the value of the field is not one of
>the acceptable values from the combo list. I've created a hidden text field
>([NSF_Certified_Unmatched]) from an unmatched query, which compares the value
>to the accepable list. I've tried using conditional formatting with
>Expression Is [Combo_NSFCertified]=[NSF_Certified_Unmatched], but this isn't
>working.
>
>I've also tried using the On Not in List with the following code:
>Private Sub Combo_NSFCertified_NotInList(NewData As String, Response As
>Integer)
>Me!Combo_NSFCertified.BackColor = vbRed
>End Sub


Why not just set the combo box's LimitToList property so an
invalid entry can not be entered?

--
Marsh
MVP [MS Access]
Re: Field Color not changing using Conditional Format or On Not In
RAN 12/3/2008 1:40:01 PM
That would work if this was the initial entry form. However the initial info
is being extracted from an Excel worksheet. My form in question is being used
to review and approve the submitted data. Any additional ideas would be
greatly appreciated. Thanks.

"Marshall Barton" wrote:

[Quoted Text]
> RAN wrote:
>
> >I've got a single form with a combo box field ([Combo_NSFCertified]) whose
> >control source is a field from a table. When the form is opened I want the
> >field background to be colored red if the value of the field is not one of
> >the acceptable values from the combo list. I've created a hidden text field
> >([NSF_Certified_Unmatched]) from an unmatched query, which compares the value
> >to the accepable list. I've tried using conditional formatting with
> >Expression Is [Combo_NSFCertified]=[NSF_Certified_Unmatched], but this isn't
> >working.
> >
> >I've also tried using the On Not in List with the following code:
> >Private Sub Combo_NSFCertified_NotInList(NewData As String, Response As
> >Integer)
> >Me!Combo_NSFCertified.BackColor = vbRed
> >End Sub
>
>
> Why not just set the combo box's LimitToList property so an
> invalid entry can not be entered?
>
> --
> Marsh
> MVP [MS Access]
>
Re: Field Color not changing using Conditional Format or On Not In
Marshall Barton <marshbarton[ at ]wowway.com> 12/3/2008 2:20:56 PM
RAN wrote:

[Quoted Text]
>That would work if this was the initial entry form. However the initial info
>is being extracted from an Excel worksheet. My form in question is being used
>to review and approve the submitted data.


Here's a shot in the dark. Use the form's Current event:

With Me!Combo_NSFCertified
If .ListIndex = -1 Then
.BackColor = vbRed
Else
.BackColor = vbWhite
End If
End With

--
Marsh
MVP [MS Access]
Re: Field Color not changing using Conditional Format or On Not In
RAN 12/3/2008 3:19:01 PM
It works! Thanks a lot.

"Marshall Barton" wrote:

[Quoted Text]
> RAN wrote:
>
> >That would work if this was the initial entry form. However the initial info
> >is being extracted from an Excel worksheet. My form in question is being used
> >to review and approve the submitted data.
>
>
> Here's a shot in the dark. Use the form's Current event:
>
> With Me!Combo_NSFCertified
> If .ListIndex = -1 Then
> .BackColor = vbRed
> Else
> .BackColor = vbWhite
> End If
> End With
>
> --
> Marsh
> MVP [MS Access]
>

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net