Crash on BackColor Reset

D

David Habercom

Thank you in advance.

Using code from Dirk Goldgar to reset all TextBoxes to Null after a cancel,
I have attempted to add code which also resets the BackColor of certain
previously changed controls. My added code works fine up to the point after
the last mis-colored control is reset, but then it crashes with the message
"Object doesn't support this property or method." Since all the affected
controls have been reset at that point, I can't see why this happens. Can
someone point me in the right direction?

Dim ctl As Access.Control
For Each ctl In Me.Controls
If ctl.ControlType = acTextBox Then
ctl.Value = Null
'If req'd field set to Lt Red, reset to Lt Yellow
If ctl.BackColor = "13408767" Then
ctl.BackColor = "10092543"
End If
End If
Next ctl
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top