Janusz
Thanks for the suggestion. I did this, and get the error
DATABASE ERROR : could not add reference entry
error code : 1062
error message : Duplicate entry '1-4' for key 'PRIMARY'
sql that failed was : INSERT INTO 0_refs (type, id, reference) VALUES ('4', '1', '2')
I haven't really sat down at looked at the E-R structure here yet to figure out the exact role of 0_refs, but preumably it is the next internal reference number to be used and something is out of sync ?? The INSERT if I dump the database is
INSERT INTO `0_bank_accounts` VALUES ('1062', '1', '1062 HSBC Current Account USD', '002', 'HSBC USD', NULL, 'USD', '0', '15', '0000-00-00 00:00:00', '0', '0');
INSERT INTO `0_bank_accounts` VALUES ('1060', '1', '1060 HSBC Current account HKD', '001', 'HSBC HKD', NULL, 'HKD', '1', '3', '0000-00-00 00:00:00', '0', '0');
INSERT INTO `0_bank_accounts` VALUES ('1064', '1', '1064 HSBC Current account GBP', '003', 'HSBC GBP', NULL, 'GBP', '0', '8', '0000-00-00 00:00:00', '0', '0');
INSERT INTO `0_bank_accounts` VALUES ('1090', '3', 'Petty cash HKD', '004', 'Petty cash HKD', NULL, 'HKD', '0', '9', '0000-00-00 00:00:00', '0', '0');
INSERT INTO `0_bank_accounts` VALUES ('1092', '3', 'Petty cash USD', '005', 'Petty cash USD', NULL, 'USD', '0', '10', '0000-00-00 00:00:00', '0', '0');
INSERT INTO `0_bank_accounts` VALUES ('1094', '3', 'Petty cash JPY', '007', 'Petty cash JPY', NULL, 'JPY', '0', '11', '0000-00-00 00:00:00', '0', '0');
INSERT INTO `0_bank_accounts` VALUES ('1096', '3', 'Petty cash SGD', '008', 'Petty cash SGD', NULL, 'SGD', '0', '12', '0000-00-00 00:00:00', '0', '0');
INSERT INTO `0_bank_accounts` VALUES ('1098', '3', 'Petty cash CNY', '009', 'Petty cash CNY', NULL, 'CNY', '0', '13', '0000-00-00 00:00:00', '0', '0');
INSERT INTO `0_bank_accounts` VALUES ('1093', '3', 'Petty cash GBP', '006', 'Petty cash GBP', NULL, 'GBP', '0', '16', '0000-00-00 00:00:00', '0', '0');
which looks sensible - all the keys are unique here.
Should I be looking at 0_refs to understand this? There is only one row in this table with values 1,4,1.
Thanks
Tim
PS I haven't touched a line of code for 30 years so sorry I can't dig into the php more :-(