Board index » delphi » Using UPDATE question

Using UPDATE question

Using D4 w/Paradox
I am trying to set values in a table based on either the existence of a
record in another table, or the existence of a value in another table.

Table2 is the detail table I want to get the values or records from.

  with Table2 do
  begin
    Open;
    if RecordCount = 0 then Exit;
    TempQuery := TQuery.Create(nil);
    TempQuery.DatabaseName := DBaseName;
    DisableControls;
    First;
    while not (EOF) do
    begin
      with TempQuery do
      begin
        Close;
        SQL.Text :=
          'UPDATE EligibleList SET CurrentStatus = "Assigned" '+
          'WHERE (SSN = "'+Table2SSN.Value+'" '+
            'AND PlanID = '+IntToStr(Table2PlanID.Value)+')';
        ExecSQL;
      end;
      Next;
    end;
    EnableControls;
    TempQuery.Free;
  end;

This part works fine, as it matches records in Table2 to the records in
EligibleList (or vise versa).  Now, I want to set the CurrentStatus value to
"Waived" if a date field value in Table2 is not null, and matches the SSN
and PlanID criteria.

Help would sure be appreciated.

Mike

 

Re:Using UPDATE question


Quote
>Now, I want to set the CurrentStatus value to
>"Waived" if a date field value in Table2 is not null, and matches the SSN
>and PlanID criteria.

If Not Table2.fieldbyName('DateField').isnull then Begin

//Do your update here

end;//if
--
Brian Bushay (TeamB)
Bbus...@NMPLS.com

Other Threads