Creating Format Conditions via Code - Available Control Properties

  • Thread starter Thread starter dch3
  • Start date Start date
D

dch3

I'm able to successfully create format conditions via code, while I'm able to
manipulate the format of the control (.enabled, .forecolor, .backcolor), is
it possible to control wether or not the field is visible or locked.

For i = 0 To Me.subfrmLoadListDetail.Controls.Count - 1
Set ctl = Me.subfrmLoadListDetail.Controls(i)
With ctl
If .Tag Like "*" & "loadListDetail" & "*" Then
For j = 0 To .FormatConditions.Count - 1
Debug.Print j, .Name, .FormatConditions.Count,
..FormatConditions(j).Expression1
Next j
'Delete all formatConditions by deleting the formatCondition
with the index of (0), .Delete will shift all of the formatConditions
'by a factor of 1 each time it is executed, so we have to
adjust accordingly throughout the loop. Using index(0) is the easiest
'way to adjust for the diminishing number of formatConditions
For j = 0 To .FormatConditions.Count - 1
.FormatConditions(0).Delete
Next j
'Disable if the record was entered via the manifest
Set newCondition = .FormatConditions.Add(acExpression, ,
"[Forms]![frmLoadList]!subfrmLoadListDetail.form!txtEntryMethod =
'Manifest'", "")
With newCondition
.Enabled = False
.BackColor = 12632256
End With
End If
End With
Next i
 
Are you just asking if you can check for visibility and locking? Why not add

ct.visible to you test in your loops

something like

if ctl.visible or ctl.locked then
do something here...
end if

hth
 
I was asking if the FC can change the visibility of a control. I have since
learned that it doesn't as there are only a handful of properties that can be
modified via a FC. I'm working with about 36 hours to finish the project and
I'm having to steam roll it.

Maurice said:
Are you just asking if you can check for visibility and locking? Why not add

ct.visible to you test in your loops

something like

if ctl.visible or ctl.locked then
do something here...
end if

hth
--
Maurice Ausum


dch3 said:
I'm able to successfully create format conditions via code, while I'm able to
manipulate the format of the control (.enabled, .forecolor, .backcolor), is
it possible to control wether or not the field is visible or locked.

For i = 0 To Me.subfrmLoadListDetail.Controls.Count - 1
Set ctl = Me.subfrmLoadListDetail.Controls(i)
With ctl
If .Tag Like "*" & "loadListDetail" & "*" Then
For j = 0 To .FormatConditions.Count - 1
Debug.Print j, .Name, .FormatConditions.Count,
.FormatConditions(j).Expression1
Next j
'Delete all formatConditions by deleting the formatCondition
with the index of (0), .Delete will shift all of the formatConditions
'by a factor of 1 each time it is executed, so we have to
adjust accordingly throughout the loop. Using index(0) is the easiest
'way to adjust for the diminishing number of formatConditions
For j = 0 To .FormatConditions.Count - 1
.FormatConditions(0).Delete
Next j
'Disable if the record was entered via the manifest
Set newCondition = .FormatConditions.Add(acExpression, ,
"[Forms]![frmLoadList]!subfrmLoadListDetail.form!txtEntryMethod =
'Manifest'", "")
With newCondition
.Enabled = False
.BackColor = 12632256
End With
End If
End With
Next i
 
Back
Top