Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
[blue] . . . and what is the conditions for boxsize?[/blue]dendic said:[blue] . . . check a field named "boxsize" for a condition and then make the background color for all fields within that record a specific color.[/blue]
Public Sub UpdateFormat()
Dim frm as Form
Dim ctl as Control
Set frm = Forms!MyFormName
For Each ctl in frm.Controls
If TypeOf ctl Is TextBox Then
Select Case condition
Case Condition 1
'Format changes here according to your needs
Case Condition 2
'Format changes here according to your needs
Case Condition 3
'Format changes here according to your needs
Case Condition 4
'Format changes here according to your needs
Case Else
MsgBox "Oops! Doesn't match any of my prescribed conditions!"
End Select
End If
Next ctl
Set ctl = Nothing
Set frm = Nothing
End Sub
Private Sub Form_Timer()
UpdateFormat
'Other Code
End Sub
Private Sub Text1_AfterUpdate()
UpdateFormat
'Other Code
End Sub
Private Sub Text2_AfterUpdate()
UpdateFormat
'Other Code
End Sub
'and so on
[blue] Dim ctl As Control, n As Integer
For Each ctl In Me.Controls
If ctl.Tag = "[purple][b]?[/b][/purple]" Then
ctl.FormatConditions.Delete
For n = 1 To 3
With ctl.FormatConditions _
.Add(acExpression, , Choose(n, "[BoxSize]=20", "[BoxSize]=40", "[BoxSize]=60"))
.BackColor = Choose(n, 16773360, 16383986, 15790335)
.ForeColor = Choose(n, 8388608, 16384, 128)
End With
Next
End If
Next[/blue]