Link to home
Start Free TrialLog in
Avatar of sudheerkns
sudheerkns

asked on

DoCmd.Transfer text not creating Primary key

I am trying to import a text file into a database table using a specifictaion i created. I was initially using the wizard to do this task. When i have written code to this using VBA, the resultant table created in the accees does not contain the primary key. whereas i specified 'let access decide the primary key when i defined the specification.

There is no problem in generating the primary key when i create the table using the wizrd but when i do it using VBA Acccess simply does not create the primary key

I am using Access 97...

sudheer
Avatar of niblick
niblick

Can you paste your vba tabel create code here, please?
Avatar of sudheerkns

ASKER

Call DoCmd.TransferText( _
            acImportDelim, _
            "Import_Leavers", _
            GetFileName(txtLeaversFilePath), _
            txtLeaversFilePath _
        )

Import_Leaver is a import specification i created
It works fine with wizard but not with code. primary key is not created. :((
According to Microsoft this is a problem:
http://support.microsoft.com/default.aspx?scid=kb;en-us;182002

You will need to import other than using TransferText if you need the primary key.
Hi niblick,

thanks for the posting. but then this is a serious problem wiht access. any suggestion on how to overcome this. Microsoft themselves say to avoid using the TransferText in code..

sudheer
ASKER CERTIFIED SOLUTION
Avatar of niblick
niblick

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks niblick

I was initially doing the same but it was taking too much of time for say 10K records even. It took 10 minutes.

so i explore using the same wizard in code.

intially it was working and now it stopped.

sudheer
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial