🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.databases.ms-access
Article #41

Re: Help - change font-color during open of a form

#41
From: Marc-A. Woog
Date: Sun, 12 Oct 1997 00:00
38 lines
1900 bytes
On Sat, 11 Oct 1997 22:52:42 +0100, "Juergen Modre" <xxx@abc.abc.abc>
wrote:

> Access 2.0
>How can you change the font-color of all textfields in a form,
>when the form is opened and it is dependend of a calculation
>of the content of one of the fields in the form????
>Acutally the font color should be set for all fields, where the
>calculation function is true, when opening it in the datasheet view.

This code is used in the OnCurrent-Event of a form to change the
forecolor of textboxes depending on several values:

Private Sub Form_Current()
    Dim frm As Form, ctl As Control
    Set frm = Me
    For Each ctl In frm.Controls
        If TypeOf ctl Is TextBox Then
            If Me("Austritt") = True Then
                If ctl.ForeColor <> RGB(255, 0, 0) Then ctl.ForeColor
= RGB(255, 0, 0)
            ElseIf Me("Unterbruch") = True Then
                If ctl.ForeColor <> RGB(0, 120, 0) Then ctl.ForeColor
= RGB(0, 120, 0)
            Else
                If ctl.ForeColor <> Me("Anrede").ForeColor Then
ctl.ForeColor = Me("Anrede").ForeColor
            End If
        End If
    Next ctl
End Sub

Hope this gives you an idea how to solve your problem...

Regards

Marc
Technical Details
Message-ID: <3440ea70.262844@news.bluewin.ch>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <343B8FA8.5FC2@cwcinc.com> <61opan$rn4@newssrv.sci.uni-klu.ac.at>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 1668c5,1ab50b004d8685f
X-Google-Attributes: gid1668c5,public
X-Google-Thread: ff0ac,2a4eb3baa09ee1fc
X-Google-Attributes: gidff0ac,public
From: mwoog@pobox.ch (Marc-A. Woog)
Subject: Re: Help - change font-color during open of a form
Date: 1997/10/12
Message-ID: <3440ea70.262844@news.bluewin.ch>
X-Deja-AN: 279789419
References: <343B8FA8.5FC2@cwcinc.com> <61opan$rn4@newssrv.sci.uni-klu.ac.at>
X-Complaints-To: news@ubnnews.unisource.ch
X-Trace: ubnnews.unisource.ch 876669483 377 (None) 195.186.24.184
Organization: Unisource Business Networks
Newsgroups: comp.databases.ms-access,at.fido.msaccess