Board index » delphi » Invalid variant typecast with Locate method

Invalid variant typecast with Locate method

Can anyone tell me why the call to Locate in the routine below gives an
"invalid variant typecast" runtime error?

TIA,

JJ.

function TFtkTL.Find (ThisField: string; ThisKey: variant): boolean;
begin
  HostDB.DBOk := TRUE;
  HostDB.DBError := c_ok;
  Find := FALSE;
  with FtkTL do
  begin
    try
      if Locate (ThisField, ThisKey, []) then
      begin
        GetFields;
        Find := TRUE;
      end;
    except
      HostDB.Ok := FALSE;
      HostDB.Error := c_tl_find;
    end;
  end;
end;

--
Email: jjqu...@dircon.co.uk
Homepage: http://www.users.dircon.co.uk/~jjquick/

 

Re:Invalid variant typecast with Locate method


Can anyone tell me why the call to Locate in the routine below gives an
"invalid variant typecast" runtime error?

TIA,

JJ.

function TFtkTL.Find (ThisField: string; ThisKey: variant): boolean;
begin
  HostDB.DBOk := TRUE;
  HostDB.DBError := c_ok;
  Find := FALSE;
  with FtkTL do
  begin
    try
      if Locate (ThisField, ThisKey, []) then
      begin
        GetFields;
        Find := TRUE;
      end;
    except
      HostDB.Ok := FALSE;
      HostDB.Error := c_tl_find;
    end;
  end;
end;

--
Email: jjqu...@dircon.co.uk
Homepage: http://www.users.dircon.co.uk/~jjquick/

Re:Invalid variant typecast with Locate method


Can anyone tell me why the call to Locate in the routine below gives an
"invalid variant typecast" runtime error?

TIA,

JJ.

function TFtkTL.Find (ThisField: string; ThisKey: variant): boolean;
begin
  HostDB.DBOk := TRUE;
  HostDB.DBError := c_ok;
  Find := FALSE;
  with FtkTL do
  begin
    try
      if Locate (ThisField, ThisKey, []) then
      begin
        GetFields;
        Find := TRUE;
      end;
    except
      HostDB.Ok := FALSE;
      HostDB.Error := c_tl_find;
    end;
  end;
end;

--
Email: jjqu...@dircon.co.uk
Homepage: http://www.users.dircon.co.uk/~jjquick/

Re:Invalid variant typecast with Locate method


Can anyone tell me why the call to Locate in the routine below gives an
"invalid variant typecast" runtime error?

TIA,

JJ.

function TFtkTL.Find (ThisField: string; ThisKey: variant): boolean;
begin
  HostDB.DBOk := TRUE;
  HostDB.DBError := c_ok;
  Find := FALSE;
  with FtkTL do
  begin
    try
      if Locate (ThisField, ThisKey, []) then
      begin
        GetFields;
        Find := TRUE;
      end;
    except
      HostDB.Ok := FALSE;
      HostDB.Error := c_tl_find;
    end;
  end;
end;

--
Email: jjqu...@dircon.co.uk
Homepage: http://www.users.dircon.co.uk/~jjquick/

Re:Invalid variant typecast with Locate method


Can anyone tell me why the call to Locate in the routine below gives an
"invalid variant typecast" runtime error?

TIA,

JJ.

function TFtkTL.Find (ThisField: string; ThisKey: variant): boolean;
begin
  HostDB.DBOk := TRUE;
  HostDB.DBError := c_ok;
  Find := FALSE;
  with FtkTL do
  begin
    try
      if Locate (ThisField, ThisKey, []) then
      begin
        GetFields;
        Find := TRUE;
      end;
    except
      HostDB.Ok := FALSE;
      HostDB.Error := c_tl_find;
    end;
  end;
end;

--
Email: jjqu...@dircon.co.uk
Homepage: http://www.users.dircon.co.uk/~jjquick/

Re:Invalid variant typecast with Locate method


Please ignore multiple postings of this message; an error with our news
server last night is responsible.

JJ.

--
Email: jjqu...@dircon.co.uk
Homepage: http://www.users.dircon.co.uk/~jjquick/

Other Threads