Don't know if anyone's had a simlar problem when migrating from 97 to XP but the following code (lifted from the popular 'Solutions' database, once available from MS as a download) won't work in XP. The code seems to loop indefinitely on first accessing and then it subsequently throws up an error at 'ctl.Enabled', saying the property is not supported.
It's called from 'EnableControls Me, acDetail, true' in the VBA of a form.
Function EnableControls(frm As Form, intSection As Integer, intState As Boolean) As Boolean
Dim ctl As Control
' Set intState for all controls in specified section.
For Each ctl In frm.Controls
If ctl.Section = intSection Then
On Error Resume Next
ctl.Enabled = intState
Err = 0
End If
Next ctl
EnableControls = True
End Function
Any advice would be greatly appreciated as I've wasted many brain cells trying to solve it so far!
Steve House
shouse@icaew.co.uk
It's called from 'EnableControls Me, acDetail, true' in the VBA of a form.
Function EnableControls(frm As Form, intSection As Integer, intState As Boolean) As Boolean
Dim ctl As Control
' Set intState for all controls in specified section.
For Each ctl In frm.Controls
If ctl.Section = intSection Then
On Error Resume Next
ctl.Enabled = intState
Err = 0
End If
Next ctl
EnableControls = True
End Function
Any advice would be greatly appreciated as I've wasted many brain cells trying to solve it so far!
Steve House
shouse@icaew.co.uk