Thank you, that was a great help. I too always use a data module and putting the code in there does work. It has, however, thrown up another error which I don't think is related. To become accustomed to Lazarus and sqlite, I have created a test record collection database. The master table contains the CD reference number and title and the detail table the individual tracks. The master table's primary key is REFERENCE (string field as it is alpha-numeric). The detail table is primary keyed on REFERENCE (to link with the master) and TRACKORDER (integer). Both tables scroll with each other correctly so the underlying structure is sound. However, after posting a test entry in the detail table, I get an error message stating the field 'REFERENCE' can not be found in the master query. After terminating the program and going back into it, the detail record HAS been posted correctly! As stated in my original question, the committing and updates are carried out in the After Post event of the Detail query. Do you have any suggestion as to what might be causing this?