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

Programatically Create Datasession

Status
Not open for further replies.

madhatter2002

Programmer
Nov 6, 2002
73
PH
Is there a way to programatically create a data session or a data environment??

For example, we have 5 tables

Table 1
Table 2
Table 3
Table 4
Table 5

and we have 3 forms, and 1 main form that can call the 3 forms.

Form1 will use table 4 for the grid
Form2 will use table1 and table 3 for Listbox and grid
Form3 will use table2 for the combo box

with the above is is possible to create data environments/session programatically.

The reason why not in design is the dbc will be created only when the program runs and is deleted once the program terminates.
 
There's no explicit need for a data environments in and of itself...

In the LOAD event (before the form exists) for the form(s) open/create/prep your temp tables.

Use the form's INIT event (after form and controls exist, but before it is visible) for code based on your temp table. e.g. I often have an 'empty' grid on a form that has columns dynamically 'created' based on a temp table.

Perform garbage collection in the QueryUnload event where you can delete your temp table using DROP TABLE etc.

Brian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top