• Status: Solved
  • Priority: High
  • Security: Public
  • Views: 92
  • Last Modified:

MS Access and Bulk Insert

I am having issues in VB bulk inserting text file to MDB. This is code that works at many client sites. I have resorted to testing my command in Access to make sure it is fit.

below DOES NOT WORK. the data is inserted, but only one column is created and all data goes into one column with the commas.
SELECT * INTO Record1TEST
FROM [Text;HDR=Yes;FMT=Delimited;Database=L:\22\vbapps.2015\SnapshotOP\SSImportOP\bin\x86\Release\].recordtype1.txt;

If I move the input file to D drive, below works:
SELECT * INTO Record1short
FROM [Text;HDR=Yes;FMT=Delimited;Database=D:\].recordtype1.txt;
0
JamesDBuskirk
Asked:
JamesDBuskirk
  • 2
1 Solution
 
Gustav BrockCIOCommented:
This can only be true if you somehow have been granted limited rights to read from that networked folder - or a very bad network connection.
If you can import the same file from any other location, it has to be so.

Alternatively, you may use a completely different method for importing the file as described here:
Import large text file to Access table
0
 
aikimarkCommented:
1. Try delimiting the path with apostrophe characters:
SELECT * INTO Record1TEST
FROM [Text;HDR=Yes;FMT=Delimited;Database='L:\22\vbapps.2015\SnapshotOP\SSImportOP\bin\x86\Release\'].recordtype1.txt;

Open in new window


2. Check for the existence of any SCHEMA.INI files and their content.

3. Check this registry key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Jet\4.0\Engines\Text
What is the value for Format?
0
 
JamesDBuskirkAuthor Commented:
Aikimark, I think we have a bingo. I found SCHEMA.INI files in my VB application and it is wrong (see below, I am creating COMMA delimited files). Sorry to have missed this I took this project over from another author and did not know of the schema.ini files. Even in Access, the presence of this schema file in the same folder as my import file seems to apply it. I just tested one that failed AFTER changing the schema.ini and it worked! Let me notify my team then I'll award the points. Gustav thank you also for assisting.

Should I fix the schema.ini in my project folder, then build it out to dEBUG/RELEASE or does this get created by VB?

on a rhetorical note, how can Microsoft not be able to figure this out? I spent an two hours on the phone with someone who just kept moving the file around and trying it over and over.

I changed the "|" to "," and now all is well! Thanks again!!!
[recordtype1.txt]
 ColNameHeader=True
 CharacterSet=ANSI
 Format=Delimited(|)
[recordtype3.txt]
 ColNameHeader=True
 CharacterSet=ANSI
 Format=Delimited(|)
[cms.txt]
 ColNameHeader=True
 CharacterSet=ANSI
 Format=Delimited(|)
1
 
JamesDBuskirkAuthor Commented:
Thanks !!!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now