Poppekop
asked on
Createcontrol cannot add
so far I have this code and I keep getting this error message:
run time error 29054
Microsoft Office Access can't add, rename or delete the control(s) you requested
this is my code, it is in a function in a module which I start from another form
Dim ctlTxt As Control
DoCmd.OpenForm "frmMain", acDesign
Set ctlTxt = CreateControl("frmMain", acTextBox, acDetail, , , 600, 600, 600, 600)
If I try this without the control ctl it works, but then I cannot set the name and other properties of the textbox I need later on in the process.
so this works, but it doesn't work for me
CreateControl("frmMain", acTextBox, acDetail, , , 600, 600, 600, 600)
and yes, I do need to do this at runtime. It needs to be build based on an XML file I get through a soap connection and I have no idea what will be in there.
run time error 29054
Microsoft Office Access can't add, rename or delete the control(s) you requested
this is my code, it is in a function in a module which I start from another form
Dim ctlTxt As Control
DoCmd.OpenForm "frmMain", acDesign
Set ctlTxt = CreateControl("frmMain", acTextBox, acDetail, , , 600, 600, 600, 600)
If I try this without the control ctl it works, but then I cannot set the name and other properties of the textbox I need later on in the process.
so this works, but it doesn't work for me
CreateControl("frmMain", acTextBox, acDetail, , , 600, 600, 600, 600)
and yes, I do need to do this at runtime. It needs to be build based on an XML file I get through a soap connection and I have no idea what will be in there.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
BTW, I don't see anything wrong with your code right off, so you may have reached the internal counter limit. Try it on a new test form and see if it works on that. If so, you hit the counter limit.
JimD.
JimD.
ASKER
wow you're still here:) I remember you helped me out with some interesting stuff years ago :)
how come the second one works? without assigning to the control object it works fine.
I cannot make fields and hide because I don't know what fields I will get. That's the trick, to make a generic app that gets an xml through a soap call, builds a form with the fields so you can edit the data, then change the XML with the new values and send it back through soap. The XML might be completetly different every time....
I'll try it with creating a new form...
how come the second one works? without assigning to the control object it works fine.
I cannot make fields and hide because I don't know what fields I will get. That's the trick, to make a generic app that gets an xml through a soap call, builds a form with the fields so you can edit the data, then change the XML with the new values and send it back through soap. The XML might be completetly different every time....
I'll try it with creating a new form...
"how come the second one works? without assigning to the control object it works fine"
Sorry, I let that point slip when I was typing my response. I'm not sure. CreateControl is supposed to return a control object. Your code does compile as it stands right?
JimD.
Sorry, I let that point slip when I was typing my response. I'm not sure. CreateControl is supposed to return a control object. Your code does compile as it stands right?
JimD.
ASKER
it compiles, the creating without assigning it t a control object works (and compiles) the other one compiles fine but gives the error.
To make things even better, creating a new form works, I put 3 controls on it, so let me see it it works when I add a few more :) just to see if your number of controls story checks out ;)
To make things even better, creating a new form works, I put 3 controls on it, so let me see it it works when I add a few more :) just to see if your number of controls story checks out ;)
ASKER
hehe yep it does check out :) I could add a control on that form.
still another big MS Access mystery why it does work if you don't assign it to a control object :-S I guess I could tweak that and just look up the control because the names access gives it are quite consistent, but I think I'll go for creating a new form.
Now I have to figure out how to add the button on that form to submit the changes....
still another big MS Access mystery why it does work if you don't assign it to a control object :-S I guess I could tweak that and just look up the control because the names access gives it are quite consistent, but I think I'll go for creating a new form.
Now I have to figure out how to add the button on that form to submit the changes....
"just to see if your number of controls story checks out ;)"
I double checked and the limit is 754, not 768 as I said earlier.
JimD.
I double checked and the limit is 754, not 768 as I said earlier.
JimD.
ASKER
uuhhmm sorry to tell you, but I could add about 900 controls before it started nagging, but it also gave a different error, that it could not add any more controls on the form (29053 instead of 29054)
"uuhhmm sorry to tell you, but I could add about 900 controls before it started nagging, but it also gave a different error, that it could not add any more controls on the form (29053 instead of 29054)"
Not sure what to tell you. I checked the A97 help first time, but just went back and looked at the A2003 help. Screenshot is attached. Clearly says the limit for controls on a form or report is 754 over the lifetime of the form or report.
Jim
Controls.jpg
Not sure what to tell you. I checked the A97 help first time, but just went back and looked at the A2003 help. Screenshot is attached. Clearly says the limit for controls on a form or report is 754 over the lifetime of the form or report.
Jim
Controls.jpg
BTW, the problem with using SET was certainly not related to the limit. That was obvious right off after you pointed out that it worked without the SET.
JimD.
JimD.
ASKER
must be a different version.
Anyway, after some experiments with other forms, the first form decided that it would accept the new controls now.
weird.... same code, and I didn;t get the errormessage.
I tested, looped creating textboxes.. it didn't complain until 896
Anyway, after some experiments with other forms, the first form decided that it would accept the new controls now.
weird.... same code, and I didn;t get the errormessage.
I tested, looped creating textboxes.. it didn't complain until 896
Relly odd, but then as programming tasks go, your out there on the bleeding edge so to speak. Not many stray into this area and we all know Microsoft documentation is less then perfect. And of course there is always the bugs as well...
JimD.
JimD.
ASKER
I know.. it's part of the charm off ms access though.. all the surprises you get...
I deleted some of the 895 textboxes and after that it happily added more to the form ;)
I'll never learn, but at least it works now so I'm happy :)
Thanks!
Heleen
I deleted some of the 895 textboxes and after that it happily added more to the form ;)
I'll never learn, but at least it works now so I'm happy :)
Thanks!
Heleen
ASKER