I want to delete all the objects (buttons, lines, txt box.. etc.) on my form in access. so i use the deletecontrol method to delete them off the form, without having to delete the form. however, when i use the for loop explained in the help section, it somehow selects only a few of the object on the form and delete them, is there something i need to do before? or can I do it in some other way? i did a count on the form to get the number of controls on the form, but it doesn't go through the entire loop. Thanks in advance.
here are the codes i use:
dim frm as form
dim ctl as control
Set frm = [Forms]![frm_org_chart_2]
For Each ctl In frm.Controls
MsgBox frm.count
strCtlName = ctl.name
'MsgBox strCtlName
DeleteControl frm.name, strCtlName
Next ctl
here are the codes i use:
dim frm as form
dim ctl as control
Set frm = [Forms]![frm_org_chart_2]
For Each ctl In frm.Controls
MsgBox frm.count
strCtlName = ctl.name
'MsgBox strCtlName
DeleteControl frm.name, strCtlName
Next ctl