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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamic/Variable UserForm. Is it possible?

Status
Not open for further replies.

ejens

Technical User
Sep 4, 2007
2
CA
I am an AutoCAD user who is new to VBA and I am working on a program to generate a block which can contain a range of attributes. from 2 sets to 24 sets.

Is there anyway to make my second UserForm Generate with the proper Number of input boxes based on the user defined value(2-24)? Or do Ihave to create a UserForm for every possibility?

Any help and advice would be appreciated.

Thanks.
ejens
 
Is this an Autocad or Access question? If it is Autocad, try forum707.
 
I've done this with VB6 forms, and I assume it can be done in Access VBA as well.

However, in Access I think I would go about this with a related table and a subform.

If the user asked for 5 textboxes, I would create 5 related records. My subform's data source would be the related table (filtered by the header record's ID). The subform would contain a single textbox (bound to the data field), with the Default View property set to "Continuous Forms".
Finally, if you set the subform's Divider Lines to false, it will give the impression of a single form with multiple textboxes.

 
Creation of controls at runtime is indeed possible in Access VBA, however it can be a real pain (especially the sizing and positioning of the controls).

I agree with JoeAtWork - a sub-form is the way to go.

Ed Metcalfe.

Please do not feed the trolls.....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top