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

Creating Tables/ Text Boxes on the fly

Status
Not open for further replies.

benu302000

Programmer
Aug 11, 2004
23
0
0
US
I have a set of three text boxes and a combo box. The functionality I need is:
if the combo box is set to a specific value (I.E. "Approved")
Then the form must create next to the set of boxes, another set just like it, which then in turn, must have the same functionality as the last set. So I'm looking at a potentially infinite number of these sets. Can anyone get me started by telling me how to create new tables and text boxes from VB? Thanks
 
Perhaps you could create a continuous form, with the AllowAdditions proerty set to true. Then in the AfterUpdate event of the Combo Box you could say:

If Me.MyComboBox <> "Approved" Then
Me.AllowAdditions = False
Else
Me.AllowAdditions = True
End If

Good luck

-Gary
 
But Does anyone know of a resource on how to add items to a form? Function calls and such?
 
See the CreateControl function and the inserttext insertlines methods to add to the forms module. You can use createtabledef for the table.
The problem you are going to have is to add the controls you must be in design view. You can switch views rather easily but it will retrigger events so you will neeed to plan for that.
Generally in access it is easier to create the controls ahead of time then set their visible property to true as you need them.
In this forums FAQ I have an example that creates a calandar dynamically. Look that over as it creates the form the controls and the module using code.
Good luck
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top