Razzak/Dennis: Thank you. The Designer is great, and usually works beautifully. I'm certain it would work here.
But I'm force-feeding myself on direct coding to get up to speed as quickly as possible. The goal here is to have an unattended routine to import and attach a general ledger code table to an existing table of glcoded transactions. The error 2801 persists despite: 1. Close/restart of RBase; 2. Use of IDQuotes; 3. PKey in place on glCode.glCodeID My test code: --file: cmd_TestAddFKey.rmd --rbse: elmpass --auth: bchitiea --crea: 2013-0703 SET TRACE ON DROP TABLE TransTest2 PROJECT TEMP TransTest2 + FROM Transaction USING * ALTER TABLE TransTest2 + ALTER COLUMN TransID + INTEGER NOT NULL PRIMARY KEY ALTER TABLE TransTest2 + ADD COLUMN glCodeID INTEGER UPDATE TransTest2 SET glCodeID = glCodeID + FROM glCode t1,TransTest2 t2 + WHERE t2.glCode = t1.glCode ALTER TABLE `TransTest2` + ADD FOREIGN KEY (`glCodeID`) + REFERENCES `glCode` DROP COLUMN glCode from TransTest2 RETURN -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of A. Razzak Memon Sent: Wednesday, July 03, 2013 10:16 AM To: RBASE-L Mailing List Subject: [RBASE-L] - Re: Error 2801: Reference table does not exist In addition ... If you wish, you may take advantage of the cool Data Designer (RBDefine) GUI interface to manage all Keys/Indexes, as follows: Database Explorer | Tables | Design Tables ... | Keys/Indexes | New Key ... Then, follow the steps to add Foreign Key or click on [Help] button for complete details. Very Best R:egards, Razzak At 12:59 PM 7/3/2013, Bruce A. Chitiea wrote: >RBGeX95(64) 9.5.2.20611 > >The codes: > >'ALTER TABLE TransTest2 ADD FOREIGN KEY (glCodeID) REFERENCES glCode' > >and > >'ALTER TABLE TransTest2 ADD FOREIGN KEY (glCodeID) REFERENCES glCode >(glCodeID)' > >... elicit the error message: > >'The referenced table does not exist (2801)' > >The referenced table and columns most certainly do exist, all data >types match. Bruce, Without knowing all details, here is an example of adding a FK, using the RRBYW18 sample database. -- Example ALTER TABLE `SalesBonus` ADD FOREIGN KEY (`EmpID`) + REFERENCES `Employee` + ('Cannot have an employee id that does not exist in the Employee table.', + 'Cannot change employee id number to a value that does not exist in the + employee table.') Notice the database setting for IDQUOTE as well as the message to be displayed. Hope that helps! Very Best R:egards, Razzak. www.rbase.com www.facebook.com/rbase -- 30+ years of continuous innovation! 15 Years of R:BASE Technologies, Inc. making R:BASE what it is today! --

