Solved

First,Edit,Next and Post ....

Posted on 2000-02-22
6
153 Views
Last Modified: 2010-04-04
is it Ok?

with Form1.TablaPersonal Do
begin
    First;
       while not Eof Do
       begin
            Edit;
            Form1.TablaPersonalDias.Value:=Form1.TablaPersonalDias.Value+45;
            Post;
            Next;
       end;
end;
0
Comment
Question by:chiro
6 Comments
 
LVL 8

Expert Comment

by:ZifNab
ID: 2546786
at first sight, yes... why not?

If it is a calculated field you better place it in the OnCalcFields event.

Zif
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 2546794
you could also use :

Edit;
FieldByName('Dias').AsInteger := FieldByName('Dias').AsInteger + 45;
Post;

Or AsFloat if you're working with float's..

Zif.
0
 
LVL 5

Expert Comment

by:TheNeil
ID: 2546801
Err no actually.

You've defined a WITH for Form1.TablaPersonal and this is what you're first, next, EOF etc. are acting on. You then try to do some modification on Form1.TablaPersonalDias but this ISN'T being placed into edit mode, posted etc.

The Neil
0
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 
LVL 8

Expert Comment

by:ZifNab
ID: 2546810
:-) since you're working with Dates... I suppose AsDateTime or AsDate would be better in the example code (then AsInteger)

Zif.
0
 

Expert Comment

by:manjushan
ID: 2549284
Hi,
  It look perfect.Provided u open ur table before that.And you have not set the fields ro read only.
        Gook luck.
                  Manju.
0
 

Accepted Solution

by:
Pandian012000 earned 100 total points
ID: 2549310
Hi chiro

I can suggest one more method to do it

place a query component ( eg. qry_update)

In the sql string write the following

update <Table name> set <fieldname> = <field name>+45

then you can execute this query

( qry_update.execsql)

I hope this will work for you

Regards

Pandian
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

809 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