Solved

stop DBNavigator from saving changes when going to next record

Posted on 2006-07-10
1
303 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Ready to get started with anonymous questions?

It's easy! Check out this step-by-step guide for asking an anonymous question on Experts Exchange.

Question has a verified solution.

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

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…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses
Course of the Month2 days, 18 hours left to enroll

622 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