Programmatically creating controls from a field list 
Author Message
 Programmatically creating controls from a field list

I am currently in the process of dynamically creating a
sub-form using different tables.
When I select a record, that record will refer to one of
several tables. I need to create a textbox for each field
in a sub-form and bind that textbox to the selected
table's field. Any pointers would be appriciated.

TIA
Paul



Tue, 29 Nov 2005 15:19:18 GMT  
 Programmatically creating controls from a field list
Paul,

  I'm assuming this is not a wizard... you're NOT hoping to be in
design view and actually create controls and then save the form, yes?

  Are you hoping for these records to be editable? (or, more
accurately, were you hoping for combo boxes and things?)

  I have done this with a subform that's displayed as a datasheet in
non-editable mode.

  I made a form w/255 text boxes and associated labels, all unbound
and invisible. I named them from "ctl001" to "ctl255".

  Then, when I set the forms recordset, I loop through its .Fields
collection to set the source (and visible property) for each control.
I also use the name of the field to set the text of the label.

-Tom

Quote:

> I am currently in the process of dynamically creating a
> sub-form using different tables.
> When I select a record, that record will refer to one of
> several tables. I need to create a textbox for each field
> in a sub-form and bind that textbox to the selected
> table's field. Any pointers would be appriciated.

> TIA
> Paul



Wed, 30 Nov 2005 01:59:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Programmatically Create a Public Distribution List

2. How to create a distribution list programmatically using outlook automation

3. Add Notes to Programmatically-Created Personal Distribution List

4. Add Notes to Programmatically Created Personal Distribution List

5. Creating fields programmatically

6. How to create custom Field for emails programmatically

7. How to programmatically create a custom field

8. Help::Custom Field in programmatically creating new item

9. Creating Text Fields Programmatically

10. programmatically create forms / ADO field properties

11. Creating text boxes (or other controls) programmatically.

12. Creating controls programmatically

 

 
Powered by phpBB® Forum Software