Need help with Object doesn't support this property or method Erro

  • Thread starter Thread starter Ayo
  • Start date Start date
A

Ayo

I am getting a "Object doesn't support this property or method" error on the
first If statement and I can't see anything wrong with the code. Can someone
give me a hand please.
Thanks.

For Each ctrl In Me.Controls
With ctrl
If .ControlType = acComboBox And .Enabled = True And .Tag <> "" Then
If Not IsNull(.Value) Then
strFilterSQL = strFilterSQL & " " & Mid(.Name, 4) & "='" &
..Value & "' AND"
End If
End If
End With
Next ctrl
 
Thanks Chris

Chris O'C via AccessMonster.com said:
The control it's testing is probably a label, which doesn't have the enabled
property. Add another If-block and test for controltype before testing if
it's a combo box and enabled. The controltype property for labels is 100.

if ctrl.Properties("ControlType") <> 100


Chris
Microsoft MVP
 
Back
Top