 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
fadhel Guest
|
Posted: Sun Aug 27, 2006 8:32 am Post subject: Save on close form |
|
|
Dear All
I'm using SDAC 3.50 on Delphi 7.1. I have 2 forms for cutomers:
1- The first form is for displaying in a dbgrid Some details of the
customers. The form contains a Dbgrid, a datasource, a Tmsquerry and 3
buttons (New, Edit and delete). (the querry is in browse mode only -
No Editing)
2- The second form is for Editing, Posting new records and deleting
With one other querry.
My first problem is how to send the current record to the second form
for editing or deleting.
My second problem is that When the user has do some changes without
posting (New record or when editing) and wants to close the second
form, I Want to ask him before closing the form if he wants to save the
changes or not. The property (Changecount used in dbexpress don't exist
in Sdac).
Thanks a lot for your help. |
|
| Back to top |
|
 |
ES Guest
|
Posted: Mon Aug 28, 2006 1:49 pm Post subject: Re: Save on close form |
|
|
fadhel wrote:
| Quote: |
My first problem is how to send the current record to the second form
for editing or deleting.
|
The question is not very clear, so I'm not sure if the question referes
to some real difficulty or oddity there may lie, specifically when using
SDAC. Or is this just a simple beginner's question. I'll assume the
later one.
So add some Public procedure to your Form2:
procedure TForm2.Enter(KeyNumber: Integer);
begin
Customer.FindKey([KeyNumber]); // Locate Customer record by it's Key
ID
ShowModal; // Show Form2
....
and then call this Form2 procedure from youd Form1 simply with the
current, active Customer number:
Form2.Enter(12345); // Active Customer ID key is 12345
| Quote: | form, I Want to ask him before closing the form if he wants to save the
changes or not. The property (Changecount used in dbexpress don't exist
in Sdac).
|
Form's OnClose event is the right place to do this kind of checkings;
procedure TForm2.FormClose(Sender: TObject; var Action: TCloseAction);
begin
CanClose := Not (Customer.State in [dsEdit, dsInsert]);
if not CanClose then
Show message('Save the changes before close.');
...
If these by chance happened to be also answers to your questions, then
you do have to spend more time by reading and studying the several DB
Examples there are in \DELPHI\DEMOS sub directory. -e.s |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|