Delete text box

S

swas

Hi,

I am trying to rebuild a datasheet from code. Before adding new fields I
need to delete existing ones. The following code:

Dim ctlColumn as Control

For Each ctlColumn In Me.Controls

If ctlColumn.ControlType = acTextBox Then

If IsDate(ctlColumn.ControlSource) Then

DoCmd.DeleteObject ctlColumn.Name

End If

End If

Next

But I get an error 13, type mismatch. I don't understand why and can't get
around it.

The text boxes controlsource / field name is a date, hence the isdate check
to ensure the right controls. This isn't causing the problem though.

Thanks in advance.

swas
 
Top