Solved

stop DBNavigator from saving changes when going to next record

Posted on 2006-07-10
1
290 Views
Last Modified: 2010-04-05
I have a bunch of DBeditboxes that are in edit mode and a DBNavigator which navigates through all of my records.  I only want my user to be able to change a record by clicking a specific button.  I have that part working when you click the button I just post the data then put the form back into edit mode.  

My problem is if you edit one of the edit boxes and then go to the next record it appears to be saving your changes in the database.  This is a very unwanted behavior any idea on how I can stop that from happening?
0
Comment
Question by:ICPooreman
1 Comment
 
LVL 26

Accepted Solution

by:
Russell Libby earned 500 total points
ID: 17073700

You can catch the BeforeAction of the navigator control and cancel the edit mode before moving to another record, eg:

Regards,
Russell

procedure TForm1.DBNavigator1BeforeAction(Sender: TObject; Button: TNavigateBtn);
begin

  with TDBNavigator(Sender) do
  begin
     if Assigned(DataSource) and (Button in [nbFirst, nbPrior, nbNext, nbLast]) and (DataSource.State in [dsEdit, dsInsert]) then
     begin
        DataSource.DataSet.Cancel;
     end;
  end;

end;
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
indy tidtcpclient threading issue 8 63
Simple Delphi Question 9 83
Intraweb download file link ? 1 107
creating threads in delphi 1 82
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now