Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cleaning up a form

Status
Not open for further replies.

cc5305

MIS
Oct 4, 2000
70
US
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
 
I guess I am getting cynic in my old age, but WHY would you want to do this in code? Terry M. Hoey
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top