?
Solved

TransferText Problem

Posted on 2003-03-03
9
Medium Priority
?
654 Views
Last Modified: 2010-08-05
I'm writing a VB Program that allows me to transfer data from a fixed width log file to an Access Database.

I'm getting the following error with my TransferText line:

DoCmd.TransferText acImportFixed, "ReaderSpec", "Data3", "H:\EE 464H\Sentinel020320032130.txt", True

acImportFixed - Variable not declared.


Is there a Reference I need to include in order to get this to be declared?  I'm new to VB and am stumped.

Thanks,

J
0
Comment
Question by:longhorn03
[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
9 Comments
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 8059181
replace the constant by its value
0
 

Author Comment

by:longhorn03
ID: 8059196
where can I find that value?
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 8059216
its value is 1
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 5

Expert Comment

by:bob_online
ID: 8059332
Are you writing a VB program or a VBA program?  If you're in an Access database, it's VBA and the constant should work.  If you running VB (VB 6.0, etc) then a lot of your code isn't going to work.
0
 

Author Comment

by:longhorn03
ID: 8059599
I'm running VB 6.0.  Would it be easier to simply do a line-by-line insertion of data into the database?

And why do you say that a lot of the code isn't going to work?

Thanks,

J
0
 
LVL 1

Accepted Solution

by:
MN_Dave earned 200 total points
ID: 8059676
In VB you would need to add a reference to the Microsoft Access Object Library.  Then create an object and punch on the TransferText method of that object. Something like this:

Dim ACObject As Access.Application

Set ACObject = CreateObject("Access.Application")

With ACObject
    .OpenCurrentDatabase filepath:="Path to Access DB"
    .DoCmd.TransferText acImportFixed, "ReaderSpec", "Data3", "H:\EE 464H\Sentinel020320032130.txt", True

End With
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 8059684
And all users of your application will need to have Access installed on their PCs.
0
 

Author Comment

by:longhorn03
ID: 8065148
Unfortunately, my preferred solution isn't working out.  However, this is the code that showed me this unfortunate fact.  Thanks for you help, everyone, I'm going to go another direction with this.

-Jonathan
0
 

Expert Comment

by:raspicui
ID: 8067063
well......you may view the priority to reference, and you can agreed the reference Microsoft Componets......

OK

 
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

752 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