Trying to add a memo field to a paradox table at runtime.

Posted on 2008-11-05
Last Modified: 2008-11-05
Hi Experts,
I have attached the function call and the function itself. The code works fine when adding an Alpha or integer column, but it errors out when adding a memo field. I am probably not calling the function correctly. Wonder whats wrong with it.
//This function call works just fine

if  DFieldExists('TABS_Coll_IP','CONFIG','port') = false then


    DAddField('TABS_Coll_IP CHAR(15)', 'CONFIG', 'port');

    porttablechg := TRUE;


//This function call errors out

if  DFieldExists('Derived_Relation_Raw','CONFIG','point') = false then


    DAddField('TABS_Coll_IP Memo', 'CONFIG', 'point');

    pointtablechg := TRUE;


//This is the function being called

Function DAddField(flddef, dbName,tblName: String): Boolean;

var q : TQuery;


       q := TQuery.Create(nil);


       q.DatabaseName := dbName;

       q.Sql.Add('ALTER TABLE ' + tblName );

       q.sql.add(' ADD COLUMN ' + fldDef );







Open in new window

Question by:QurbanDurrani
    LVL 13

    Accepted Solution

    If you are using the BDE then I believe you need to call the dbiDoRestructure or something function using the BDE - you should come right by searchng for similar questions on ee such as "paradox add field" or "paradox rename field" or "paradox delete field" etc

    Author Comment

    Thanks rfwoolf for your response.
    I actually figured it out with the help of a friend of mine. You deserve the points for at least trying. I'll attach the corrected code. I actually had to replace the word 'Memo' with 'BLOB' in the call to the function.

    //corrected function call
    if  DFieldExists('Derived_Relation_Raw','CONFIG','point') = false then
        DAddField('Derived_Relation_Raw BLOB', 'CONFIG', 'point');
        pointtablechg := TRUE;

    Open in new window

    LVL 13

    Expert Comment

    That's very kind of you QurbanDurrani.
    I recall a whle back I did manage to make certain changes using SQL, but other changes like renaming a field I think  had to use the BDE's routines like dbiDorestructure.
    I have since migrated to Firebird (recently actually) which was a very gruelling process because my entire application was strongly bound to paradox and firebird had all kinds of data idiosynchrisys but in the end I think it was worth it.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
    Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now