Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Pascal Delphi Databases > problem w/ loca...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 17 Topic 894 of 985
Post > Topic >>

problem w/ locate function...need ur input guys...

by "shotokan99" <soft_devjava@[EMAIL PROTECTED] > Feb 21, 2006 at 06:48 PM

im working with delphi 4..using .dbf and .mdx files.. try to look at
this code:

procedure TTimeForm.sekTime(Sender: TObject;
regin:string;regout:string;
          regin2:string;regout2:string);
var
  //some var here..
begin
 with dmod.ETIME do
 begin
   open;

   // if record is existing... no insertion will be done instead it
will edit the
   // remaining field of the same record...
   if locate('idno;wdate',vararrayof([id,curdate.caption]),[]) then
   begin
      if fieldbyname('timeout').asstring='' then  //time out ..1st
      begin
         //if timeout field is empty or null.. edit and place value

      end
      else if fieldbyname('timein2').asstring='' then   //time in..2nd
      begin
          //if timein2 field is empty or null.. edit and place value
      end
      else if fieldbyname('timeout2').asstring='' then   //time
out..2nd
      begin
          //if timeout2 field is empty or null.. edit and place value
      end;
   end;

   //if record does not exist... it will insert a record.
   if not locate('idno;wdate',vararrayof([id,curdate.caption]),[]) then
   begin
      // insert idno, date...make new record here...
   end;
   close;
 end;
end;

----------------------------
im totally novice to delphi...for me this algo make sense. my
problem..sometimes if the record is existing already, instead of doing
some editing, it inserts new record.

can someone pls point out if what's wrong w/ my code?

tnx...
 




 17 Posts in Topic:
problem w/ locate function...need ur input guys...
"shotokan99" &l  2006-02-21 18:48:58 
Re: problem w/ locate function...need ur input guys...
"pr" <pr@[EM  2006-02-22 06:43:28 
Re: problem w/ locate function...need ur input guys...
"shotokan99" &l  2006-02-21 21:25:27 
Re: problem w/ locate function...need ur input guys...
"pr" <pr@[EM  2006-02-22 17:13:37 
Re: problem w/ locate function...need ur input guys...
"Bruce Roberts"  2006-02-22 12:25:49 
Re: problem w/ locate function...need ur input guys...
"shotokan99" &l  2006-02-23 18:44:29 
Re: problem w/ locate function...need ur input guys...
"Bruce Roberts"  2006-02-24 17:30:46 
Re: problem w/ locate function...need ur input guys...
"pr" <pr@[EM  2006-02-24 05:46:59 
Re: problem w/ locate function...need ur input guys...
"shotokan99" &l  2006-02-24 21:02:08 
Re: problem w/ locate function...need ur input guys...
"Bruce Roberts"  2006-02-25 13:48:52 
Re: problem w/ locate function...need ur input guys...
"pr" <pr@[EM  2006-02-26 05:29:43 
Re: problem w/ locate function...need ur input guys...
Jamie <jamie_ka1lpa_no  2006-02-26 09:47:56 
Re: problem w/ locate function...need ur input guys...
"shotokan99" &l  2006-02-24 21:03:18 
Re: problem w/ locate function...need ur input guys...
"shotokan99" &l  2006-02-24 21:03:45 
Re: problem w/ locate function...need ur input guys...
"shotokan99" &l  2006-02-24 21:04:21 
Re: problem w/ locate function...need ur input guys...
"shotokan99" &l  2006-02-24 21:06:54 
Re: problem w/ locate function...need ur input guys...
"shotokan99" &l  2006-02-25 23:31:53 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sun Jul 6 6:08:25 CDT 2008.