Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 187
  • Last Modified:

Problem with append using DBGrid

I have a popup menu associated to the DBGrid. When I choose Add item from the menu (righ-clicking on the DBGrib), the append method do not work correctly. If I used the same code but called from a button click, all is fine.

My code:
    SelfSource.DataSet.Append;
    DBEdtNom.Setfocus;
    btnAdd.Enabled := true;

Don<t understand why it don't at one place and not from the other????
0
pjroy
Asked:
pjroy
  • 2
1 Solution
 
MatveyCommented:
Hmmm, please, if it's not so hard, send me the sources to bosism@netvision.net.il
0
 
JaccoCommented:
Tried it and it works fine here...
0
 
pjroyAuthor Commented:
To Matvey:

I sent you a mail with my source!
Thanks a lot
0
 
MatveyCommented:
Seen the project, and for anybody elese interested:

The problem is in the sequence of the commands.

Now you have these lines of code:

  SelfSource.DataSet.Append;
  DBEdtNom.Setfocus;
  btnAdd.Enabled := true;

Just exchange the two first lines:

  DBEdtNom.Setfocus;
  SelfSource.DataSet.Append;
  btnAdd.Enabled := true;

Cheers everybody
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now