Hola. Prueba a construir la sentencia SQL de esta forma.
Código Delphi
[-]
qtabla:=dbserver+'\@viajes.db';
with data.qapagos do
begin
close;
SQL.Clear;
SQL.ADD('select * from '+qtabla+' where referencia = :xreferencia ');
parambyname("xreferencia").asinteger:=_referencia;
open;
end;
Nota: No la he probado, a lo mejor debes usar la función QuotedStr.
SQL.ADD('select * from '+QuotedStr(qtabla)+' where referencia = :xreferencia ');