Dynamically Generate Textboxs in the form by programming

usermj

Registered User.
Local time
Today, 22:24
Joined
Dec 12, 2004
Messages
39
Hi guys,

Is there chance I do dynamically create the TextBox objects on the form by use of programming.

For example:

I use combox to offer user the selections, whose values could be 1, 2, 3, 4 etc. After user made a choice, the system can automatically generate and display the appropriate numbers of Textboxs below.

The value from each Textbox will be saved into database as an individual record.

The reason is that:

First, it can limit the number of records which will be saved into the database, basing on the users’ selection.

Second, they can share the same form interface, which are only different on the number of TextBox (objects) generated at the runtime.


Any idea and comments will be more welcome.

Thanks
 
Why not use a form and subform like most would?
 
SJ McAbney said:
Why not use a form and subform like most would?

If use the SubForm (in the DataSheet view), it can work out whateven numbers of records the users want to input.

But could it control the number of records the users could enter depending on the selection they made already??

The DataSheet view of subform will only continue create the new record when the users swap to the next line....

Is there any chance I can control it?

Many thanks
 
Why not have the text boxes on the form but invisible. When the user selects 4 from the combo box then something like this on the After Update event of the Combo Box.

Private Sub cboName_AfterUpdate()
Dim iloop as integer

' loop through and hide all textboxes except for those selected.

For iloop = 1 to total_number_of_textBoxes
Me("txtBox" & iloop).visible = iloop <= cboName
Next iloop

End Sub

Peter
 

Users who are viewing this thread

Back
Top Bottom