Selasa, 21 April 2020

Re: [MSAccessProfessionals] Change Forecolor and backcolor

I would first consider just hiding the control. Select all of the controls to hide and enter "Hide" into their Tag properties. 

I'm not sure where your decision to display or not comes from but set the booHide and run the code.

    Dim ctlVar As Control
    Dim booHide As Boolean
    booHide = False
    For Each ctlVar In Me.Controls
        If ctlVar.Tag = "Hide" Then
            ctlVar.Visible = Not booHide
        End If
    Next


Regards,
Duane

From: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io> on behalf of crystal (strive4peace) via groups.io <strive4peace2008=yahoo.com@groups.io>
Sent: Tuesday, April 21, 2020 2:21 AM
To: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io>
Subject: Re: [MSAccessProfessionals] Change Forecolor and backcolor
 

hi Domenico,

you may want to test:

If ctlVar.FormatConditions.count >0 Then

unless there is a specific reason you only want to change it if it has exactly 1

kind regards,
crystal

msaccessgurus.com


On 4/21/2020 1:39 AM, domcoz wrote:
Thanks Duane,

I modified the code like this:

    Dim ctlVar As control
    For Each ctlVar In Me.Controls
        If ctlVar.visible = True Then
            Select Case ctlVar.ControlType
                Case acTextBox
                    On Error Resume Next
                    If ctlVar.FormatConditions.count = 1 Then
                        ctlVar.FormatConditions.Delete
                    End If
                    ctlVar.ForeColor = RGB(255, 255, 255)
                    ctlVar.BackColor = RGB(255, 255, 255)
            End Select
        End If
    Next

I'll explain: I have a complex report and my boss asked me to be able to print it without values. and then I thought about this trick.

Thanks a lot,.

Domenico

Tidak ada komentar:

Posting Komentar