developingprogrammer
asked on
dynamically generating form
hey guys, how do i dynamically generate a form?
2 ways i can think of, but i need your help for execution.
1) use vba to call form wizard and configure the form via vba - hopefully using vba to configure the wizard to configure the form, so vba never talks directly to the form, only to the wizard.
2) create a generic continuous form, change the recordsets, controls have generic names, hide and show the controls based on the recordset field count, RESIZE AND POSITION THE CONTROLS (i don't know how to do this guys, could yall teach me?)
hrmm i think option 2 is better.
guys do yall have a sample generic form code that i could use? or if yall could teach me how to resize column width based on content and position the controls relative to each other, that would be great!! = ))
edit: yup guys, i'm going down the 2) path. creating a robust generic form is the right thing to do and i must do my best to always do the right things!! = ))
2 ways i can think of, but i need your help for execution.
1) use vba to call form wizard and configure the form via vba - hopefully using vba to configure the wizard to configure the form, so vba never talks directly to the form, only to the wizard.
2) create a generic continuous form, change the recordsets, controls have generic names, hide and show the controls based on the recordset field count, RESIZE AND POSITION THE CONTROLS (i don't know how to do this guys, could yall teach me?)
hrmm i think option 2 is better.
guys do yall have a sample generic form code that i could use? or if yall could teach me how to resize column width based on content and position the controls relative to each other, that would be great!! = ))
edit: yup guys, i'm going down the 2) path. creating a robust generic form is the right thing to do and i must do my best to always do the right things!! = ))
ASKER
great thanks pdebaets! i was just typing an edit to my question ha = )
how do i add a control programmatically?
how do i add a control programmatically?
ASKER
has anyone written a tutorial on this? like matthewspatrick's comprehensive articles on different topics.
questions that will come in would be, what is anchoring and how to use it programmatically in this generic form as well - expandable, shrinkable etc - i've frankly got no idea at this point other than the linguistic inferences haha = )
this may be come an extensive topic.
questions that will come in would be, what is anchoring and how to use it programmatically in this generic form as well - expandable, shrinkable etc - i've frankly got no idea at this point other than the linguistic inferences haha = )
this may be come an extensive topic.
ASKER
guys, sorry to type too quickly in excitement - i should have googled it before posting. but here's what i found - really good thread to steer us in the right direction (misled people like me!! haha = )) )
http://www.utteraccess.com/forum/lofiversion/index.php/t1443372.html
http://www.utteraccess.com/forum/lofiversion/index.php/t1443372.html
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
thanks pdebaets,
i'm using a continuous form now and i've arranged 10 txt boxes nicely side by side. i want to hide one and get all the rest to move to the left and cover up the blank left by that. is this possible? i think it's not and the solution is to create a copy of the form and delete the control. am i right or there is a better way? thanks!! = ))
i'm using a continuous form now and i've arranged 10 txt boxes nicely side by side. i want to hide one and get all the rest to move to the left and cover up the blank left by that. is this possible? i think it's not and the solution is to create a copy of the form and delete the control. am i right or there is a better way? thanks!! = ))
ASKER
guys, for moot, why doe this work
DoCmd.CopyObject , "fsubInstance", acForm, "fsubTemplate"
but this not work?
DoCmd.TransferDatabase acExport, "Microsoft Access", CurrentDb.Name, acForm, "GenericForm", "GenericForm_Test"
i use the transferdatabaseacexport for tables and it works fine
DoCmd.CopyObject , "fsubInstance", acForm, "fsubTemplate"
but this not work?
DoCmd.TransferDatabase acExport, "Microsoft Access", CurrentDb.Name, acForm, "GenericForm", "GenericForm_Test"
i use the transferdatabaseacexport for tables and it works fine
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
oops guys, ignore my copy form post, it work now. i had to compact and repair the database
ASKER
You may want to start a new thread for new problems. Hopefully my code sample above gets you started with moving and sizing controls on a form. Another trick is to put text in the tag property of controls to include/exclude them from moving and sizing.
ASKER
alrighty got it, thanks pdebaets!! = ))
dim ctl as control
'* Move form controls over to the right a bit
for each ctl in me.controls
ctl.left = ctl.left + 15
next ctl