You'd need to open the form in DESIGN mode to add the control, SAVE that change, and then re-open the form in FORM VIEW (e.g., standard) mode.
Depending on what you really want to do, it may be easier to add the control normally, make it invisible, and make it visible when the situation warrants it. Much easier.
How many of you believe in telekinesis? Raise my hand...
Another free Access forum:
Actually Im trying to show creosstab query in subform datasheet. The main problem is the crosstab query can have different number of columns in runtime. Then if I use form in the datasheet view it must have all controls asociated with fields in it when I open it. But I can find out the number of columns only when I open the form.
The other way to have is hidding columns in datasheet view but it has two drawback:
1) I have to create all controlls on form (but I don't know how many I will need it)
2) The user can accidentaly change the size of hidden column and display it
Jim is right, there is no way to add controls to a form unless it is in design view, even using code it must be in design view. Even if you do not know in advance how many controls you will need to display your query, maybe you can figure out some sort of maximum and use Jim's idea above about hidden controls. You can set the controlsource of the different controls to match the fields that were returned. Alternatively, you can create a form in code and then add the controls you need before displaying it.
thank you for your replies. Recently I have found out the main constraint in using design view and CreateControl: It doesn't work in compiled MDE database. So I had to give up that idea. Now I do the job by having fixed number of existing controls and hiding appropriate columns in datasheet view. It works fine except of the possibility of resizing the hidden columns. Do you have any idea how to disable column resizing in datasheet view?
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.