G
Guest
Has anyone ever had a problem with Access not letting you add controls to a form
I have a form that we dynamically build based on other criteria. When they select from a drop down list, I need to clear all controls on this subform and then re add the appropriate controls. this seems to work for a while, but at some point I must hit an Access limit, b/c I will eventually encounter an error about not being able to add any more controls to this form. I have 9 fields on this form and after I perform this logic 80 times, I get this error. Is there something magic about 720
I use the following code to accomplish this
To open the form in design view while in code..
DoCmd.OpenForm "frmUWInputDistributionGrid", acDesign, , , , acHidde
To delete control
Do While myForm.Controls.count <>
For Each MyControl In myForm.Control
DeleteControl MyFormName, MyControl.Nam
Nex
Loo
To re-add control
For Each MyField In MyRecordSet.Field
ControlName = MyField.Nam
Set MyControl = CreateControl(MyFormName, acTextBox, , , ControlName
MyControl.Name = ControlNam
Nex
I have a form that we dynamically build based on other criteria. When they select from a drop down list, I need to clear all controls on this subform and then re add the appropriate controls. this seems to work for a while, but at some point I must hit an Access limit, b/c I will eventually encounter an error about not being able to add any more controls to this form. I have 9 fields on this form and after I perform this logic 80 times, I get this error. Is there something magic about 720
I use the following code to accomplish this
To open the form in design view while in code..
DoCmd.OpenForm "frmUWInputDistributionGrid", acDesign, , , , acHidde
To delete control
Do While myForm.Controls.count <>
For Each MyControl In myForm.Control
DeleteControl MyFormName, MyControl.Nam
Nex
Loo
To re-add control
For Each MyField In MyRecordSet.Field
ControlName = MyField.Nam
Set MyControl = CreateControl(MyFormName, acTextBox, , , ControlName
MyControl.Name = ControlNam
Nex