Results 1 to 1 of 1
  1. #1
    Join Date
    Nov 2003

    Unanswered: Creating a new FoxPro DBF with a CDX file


    I am trying to create a new FoxPro table that uses a CDX file using the FoxPro ODBC interface. I can create the table just fine using the "CREATE TABLE" command, but there is no CDX created with the table. When examining the file and referencing the format of the DBF, the byte that indicates the file has a structural CDX, byte 28, is not set to 0x01 as it would be if it had one. Is there additional syntax that needs to be included in the CREATE TABLE command to write the CDX as well?

    Here is my CREATE TABLE command:
    dbconn.Execute "Create Table PPOPUP (CODE char(20), SUBCODE char(20), DESCR char(50), PAGES I(1))"

    Also any CDX with the same name as my dbf gets deleted when I execute the "CREATE TABLE" command.

    I have tried using the "INDEX" command exposed by the ODBC driver,
    but I always get a "Syntax Error or Access violation" error when doing so. Below is a sample of what I do with the INDEX command

    dbconn.Execute "INDEX ON Code TAG Code"

    Code is a name of the field in the table.

    Can someone point me in the right direction? I have been trying to generate this CDX for two days now! It seems like such a simple thing, yet I can't get it to work! I am using VB6 SP5. Thanks!!!
    Last edited by dhahn36; 11-13-03 at 18:36.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts