Board index » delphi » Closed dataset when property Active set to True

Closed dataset when property Active set to True


2003-09-17 09:18:22 PM
delphi225
I have the following.
A browseForm with a browse, tADOquery and tDataSource
The browseForm has an edit button.
The edit button opens an edit form that has a tDataSource.
The editForm.tDataSource.tDataSet = browseForm.tADOquery. This is set in
the properties, not in code.
This works fine the first time you open browseForm duing the execution of
the program.
If you open browseForm a second time it works, but the edit button places
the cursor on the same record as the first time the form is opened. Edits
to the record also do not appear in browseForm. It seems the
editform.DataSource becomes disassociated with the browseForm.DataSet
Any help on this elusive issue is appreciated.
Steve
 
 

Re:Closed dataset when property Active set to True

Quote
Propably the first BrowseForm is not freed but only hidden. Try adding
Action := caFree; into the BrowseForms onCloseQuery event.
I added Action := caFee to the BrowseForms onClose event. The onCloseQuery
gave a compile error.
Are you saying that many of the forms I create continue to exist after I
close them unless I use the Action:=caFree?
Quote
If there might be several browseforms opened at the same time, then You
can not use the property linking of the forms, but You should make this
assosiation in the code. This is because the link is made upon the
"Name" property of the other form. But if You create a second instance
of form, the name is changed into something like "OriginalFormName_2".
Is it better coding practice to make the linked data association in the
code?
I tried
EditForm.DSClients.DataSet.IsLinkedTo(browseForm.DSClients) but reccieved an
access violation.
I then moved on to try something else.
Thank you,
Steve
 

Re:Closed dataset when property Active set to True

Steven Helms writes:
Quote
I have the following.
A browseForm with a browse, tADOquery and tDataSource
The browseForm has an edit button.
The edit button opens an edit form that has a tDataSource.
The editForm.tDataSource.tDataSet = browseForm.tADOquery. This is set in
the properties, not in code.

This works fine the first time you open browseForm duing the execution of
the program.
If you open browseForm a second time it works, but the edit button places
the cursor on the same record as the first time the form is opened. Edits
to the record also do not appear in browseForm. It seems the
editform.DataSource becomes disassociated with the browseForm.DataSet
Propably the first BrowseForm is not freed but only hidden. Try adding
Action := caFree; into the BrowseForms onCloseQuery event.
If there might be several browseforms opened at the same time, then You
can not use the property linking of the forms, but You should make this
assosiation in the code. This is because the link is made upon the
"Name" property of the other form. But if You create a second instance
of form, the name is changed into something like "OriginalFormName_2".
--
Gert