Set Alias Code Not Working - Any Ideas ?

Quote
>From Steve Koterski
>To alter the properties that define a BDE alias, you use the TSession.ModifyAlias method.

var
AParams: TStringList;
  Dir: string;

The procedure below displays the InputQuery EVERY time the program is
run, what I want it to do is just go ahead and change the alias
information if/when the directory is changed

More importantly, this procedure never gets a chance to run, due to a
startup error

Exception EDBEngineError in module MyProg.Exe at 00055632
Path Not Found
File: C:\MyDir\MyFile.Dbf

What needs to be done to have the program (form) automatically set the
alias information to the current directory whenever it is started and
detects that the directory has been changed?

procedure TCatInfo.FormActivate(Sender: TObject);
begin
  if not Session.IsAlias('catinfo') then begin
    ShowMessage('Alias catinfo does not exist');
    Exit;
  end;
  AParams := TStringList.Create;
  try
    // get the current PATH parameter
    Session.GetAliasParams('catinfo',AParams);
    Dir := Copy(AParams.Strings[0],6,255);
    // get the new PATH parameter
    if InputQuery('catinfo Alias Path','Path:' ,Dir) then begin
      // Update the alias parameters
      AParams.Clear;
      AParams.Add('PATH=' + Dir);
      Session.ModifyAlias('catinfo',AParams);
      Session.SaveConfigFile;
    end;
  finally
    AParams.Free;
  end;
end;

John Thomas Smith
jtsm...@pacifier.com
http://www.pacifier.com/~jtsmith
house for sale information at
http://www.pacifier.com/~tkaufman