?
Solved

.docmd.transfertext via vb

Posted on 2005-03-10
2
Medium Priority
?
708 Views
Last Modified: 2008-02-01
I am using VB 6 and referencing MS Access to transfer a text file into a table.

below is a section of code i am using:

Dim ACObject As Access.Application
Set ACObject = CreateObject("Access.Application")

With ACObject
    .OpenCurrentDatabase filepath:="" & App.Path & "\some_db.mdb "
    .DoCmd.TransferText acImportDelim, "ReaderSpec", "Hierarchy-20050310", strFilename, True

End With

i have never used the .docmd.transfertext..... and i am not sure what i need to specify in each of the fields.
i get an error message that states : Runtime error 3625....The text file specification 'ReaderSpec' does not exist . You can not import,export or link  using the  specification.

What is the correct syntax to use?


ok, in the specification area where i have  'ReaderSpec' .  I have placed an empty string in its place (""), now i get an error (runtime 2391) that says my field names do not exist in the destination table.

I have all the field names in the table.  I am not sure why i get this error.
0
Comment
Question by:JoannieJefferson
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 41

Accepted Solution

by:
shanesuebsahakarn earned 2000 total points
ID: 13509946
In order to define an import spec (which you will need in this case), open the Access database, click File->Get External Data->Import. Choose text files. and go through the wizard, defining your options. When you reach the last page, click Advanced and click Save As. You can now save the spec asa ReaderSpec, which you can now use in your code as above.
0
 

Author Comment

by:JoannieJefferson
ID: 13510127
It works.....Thank you!
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

771 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