wait window nowait "Updating RIDefinitions table. Please, wait..." local llRIOpen, lnInsert, lnUpdate, lnDelete, ; lcParent, lcChild, lcParentTag, lcChildTag, ; lcParentExpr, lcChildExpr, oError, lnSelect, lcRITable lnSelect = select() llRIOpen = .t. lcRITable = addbs(justpath(dbc()))+"RIDefinitions.dbf" select 0 if not indbc("RIDefinitions","TABLE") && Table is not yet part of the database try create table (m.lcRITable) (ParentTB C(128), ; ChildTB C(128), ; ParentTag C(10), ; ChildTag C(10), ; ParentKey C(221), ; ChildKey C(221), ; InsTrigger I, ; UpdTrigger I, ; DelTrigger I) index on upper(ParentTB) tag ParentTB additive index on upper(ChildTB) tag ChildTB additive catch to oError when .t. =messagebox("Error in generating RIDefinitions table!" + chr(13) + ; oError.message + chr(13) + ; "Error #:" + transform(oError.ErrorNo) + chr(13) + ; "Line #:" + transform(oError.lineno) + chr(13) + ; "Error #:" + transform(oError.LineContents),48,"Error") llRIOpen = .f. endtry else try use RIDefinitions exclusive zap catch llRIOpen = .f. =messagebox("There is a problem opening RIDefinitions table." + chr(13) + ; "Re-run RIBuilder later", 48, "Problem in RI builder") endtry endif if m.llRIOpen select riDD scan lnInsert = this.get_ri_char(dd_insert) lnUpdate = this.get_ri_char(dd_update) lnDelete = this.get_ri_char(dd_delete) if m.lnDelete = 0 and m.lnUpdate = 0 and m.lnInsert = 0 ** then don't insert these records else lcParent = upper(alltrim(DD_Parent)) lcChild = upper(alltrim(DD_Child)) lcParentTag = upper(alltrim(DD_ParTag)) lcChildTag = upper(alltrim(DD_ChiTag)) lcParentExpr = upper(alltrim(DD_ParExpr)) lcChildExpr = upper(alltrim(DD_CHIEXPR)) insert into RIDefinitions (ParentTB, ; ChildTB , ; ParentTag , ; ChildTag , ; ParentKey, ; ChildKey , ; InsTrigger , ; UpdTrigger , ; DelTrigger ) ; values ; (m.lcParent, m.lcChild, ; m.lcParentTag, m.lcChildTag, ; m.lcParentExpr, m.lcChildExpr, ; m.lnInsert, m.lnUpdate, m.lnDelete) endif endscan use in select('RIDefinitions') && Close the table endif select (m.lnSelect) wait clear return m.llRIOpenIn the Insert statement I had to switch to using variables (originally I had upper(alltrim() directly in the statement and I was getting the same error as you. I don't understand, why.