Using VBA to Delete All Controls from an Access 2003 Form
I have a form that needs to have all of the controls deleted each time it loads. The number of controls and their names vary based on the results of a query, so I have code that creates new controls and control names each time the form is loaded. Before I create the controls, I need to delete the controls created from the previous time the form was loaded. i tired the following code, but it returns an error message:
Dim Ctrl As Control
For Each Ctrl In Forms!addresses
DeleteControl Forms!addresses, Ctrl
Any ideas how to delete all controls on the form without knowing in advance exactly how many there are?