using tag to iterate closing/opening db tables lazarus / 16-Databases ---------------------------------------------------------------------- davesimplewear · 2009-05-17 01:40 Hi, I wish to close/open approx 20 tables without naming each one individually, I thought I might be able to iterate through them by using the tag property, could someone please provide an example of how to do this or suggest another way of doing it. I have tried the following but shows an error if I try to compile. Procedure Form1.FormShow(Sender); var I:integer; begin  for I := 0 to TtableType.tag  do begin     TtableType.Active := True;  end; end; ---------------------------------------------------------------------- Marc · 2009-05-18 09:16 You don't need a tag for this. You can also iterate through your components (assumed that your tables are on the form) Code: [Select]var   n: integer;   c: TComponent; begin   for n := 0 to ComponentCount - 1 do   begin     C := Components[n];     if C is TDataset then TDataSet(C).Open;   end; ---------------------------------------------------------------------- davesimplewear · 2009-05-18 13:01 Thanks Marc, that worked well, much appreciated.