First time I've had to post but I'm stumped!! I'm a reasonably experienced Delphi programmer but NOT with database based scripts - so this could well be something really stupid.
The script below produces the standard EOF/BOF error when run. The basic idea is that an Access database is read and used to populate a TTreeview component. There are 2 tables - TTypes and Treg. TTypes provides the parents and related records in TReg provide the children. All is fine so long as each TType has a corresponding child record in TReg, but if the ADOQuery component returns no results then an error occurs when it is closed in preparartion to redefine its SQL for the next query.
In the code snippet the DB2Tree procedure is run first.
So what have I done wrong??
All help really really appreciated!!!
//<---------start code snippet
with mainQuery do
SQL.Add('SELECT TReg.Registration, TReg.Type FROM TReg WHERE (((TReg.Type)="'+parentreg.text+'"))');
while not mainQuery.eof do
//procedure to read the contents of the database to the tree
NodeText : String;
NextNode, NodeChild : TTreeNode;
NextNode := treedb.TopItem;
while NextNode <> nil do
NodeText := NextNode.Text;
if UpperCase(NodeText) = UpperCase('Aitcraft Types') then