I have a PageControl with 10 tabsheets on a form. Each of the tabsheets has a name almost identical to the query that populates it. For instance, the TQuery qryCaseNotes is displayed on the TabSheet named CaseNotes, the FileLocation tabsheet is populated by qryFileLocation. For each of these pages I need to pass the same parameters to the query (CasePrefix and CaseNumber). Instead of writing almost identical code for each of the 10 pages, I wanted to write a procedure that I pass the query to, fill in the parameters, run it and if something is returned change the Visible property to true. Something like this:
Except this isn't working! The main problem is in the assignment of the Tabsheet name. Any suggestions?
Thanks!
Leslie
Code:
procedure GetInfo(AQuery : Tquery);
var
ATabSheet : TTabSheet;
begin
ATabSheet := rightstr(AQuery.Name,length(AQuery.Name - 3)); //remove the qry from the beginning of QueryName
with AQuery do
begin
ParamByName('CASPRE').AsString := Form_Main.strCasPre;
ParamByName('CASNUM').AsInteger := Form_Main.intCasNum;
Active := True;
If not IsEmpty then
Form_CaseInformation.ATabSheet.TabVisible := True;
end;
end;
Except this isn't working! The main problem is in the assignment of the Tabsheet name. Any suggestions?
Thanks!
Leslie