With DM1.Query1do
begin
if Active=True then
Active:=False;
Sql.Clear;
Sql.Add('select * from Project as P');
Sql.Add('Where P.Project_Name=rojectname');
ParamByName('projectname').AsString:=Trim(Cob1.Text);
Active:=True;
result:=Lookup('Project_Name',Trim(Cob1.Text),'Project_No');
tempTableName:=Trim(Cob1.Text)+floattostr(result);
with DM1.Query3do
begin
if Active=True then
Active:=False;
Sql.Clear;
Sql.Add('select * from '''+tempTableName+''' as T');
Sql.Add('where T.Project_No=rojectno');
ParamByName('projectno').AsFloat:=result;
active:=True;
end;
QR_SelectPro.Preview;