Remarque
L’accès à cette page nécessite une autorisation. Vous pouvez essayer de vous connecter ou de modifier des répertoires.
L’accès à cette page nécessite une autorisation. Vous pouvez essayer de modifier des répertoires.
Se produit lorsque la section spécifiée est de nouveau tracée.
Syntaxe
expression. Peinture
expression Variable qui représente un objet Section .
Exemple
L’exemple suivant montre comment définir la propriété BackColor d’un contrôle en fonction de sa valeur.
Private Sub SetControlFormatting()
If (Me.AvgOfRating >= 8) Then
Me.AvgOfRating.BackColor = vbGreen
ElseIf (Me.AvgOfRating >= 5) Then
Me.AvgOfRating.BackColor = vbYellow
Else
Me.AvgOfRating.BackColor = vbRed
End If
End Sub
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
' size the width of the rectangle
Dim lngOffset As Long
lngOffset = (Me.boxInside.Left - Me.boxOutside.Left) * 2
Me.boxInside.Width = (Me.boxOutside.Width * (Me.AvgOfRating / 10)) - lngOffset
' do conditional formatting for the control in print preview
SetControlFormatting
End Sub
Private Sub Detail_Paint()
' do conditional formatting for the control in report view
SetControlFormatting
End Sub
Assistance et commentaires
Avez-vous des questions ou des commentaires sur Office VBA ou sur cette documentation ? Consultez la rubrique concernant l’assistance pour Office VBA et l’envoi de commentaires afin d’obtenir des instructions pour recevoir une assistance et envoyer vos commentaires.