473,394 Members | 1,902 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

transfertext imports incorrectly - weird values

i've been trying to automate a text import. When i use "Get External
Data" the process works fine, but does not work when I try to use a
macro or VB code.

here is the code i tried (and yes, i tried using the macrto function
also):

Private Sub cmdImp_Click()
Dim dbPath As String
dbPath = Application.CurrentProject.Path
Dim accPath As String
accPath = dbPath & "\acc.txt"
DoCmd.TransferText , , "acc", accPath, -1
End Sub

The txt file is comma separated and has field names. I am importing
into an existing table after having deleted all existing records. The
data goes into the table ("acc"), but the first column has incremental
values in it (as if it were Autonumber) instead of the values in the
txt file. The numbers in the first column often start with a zero so
data type is String...

any ideas?

thanks!

Aug 28 '06 #1
7 1483
did you create an import spec? I don't see you passing the import
specification in the import routine. If you do that, you force the
fields to be interpreted in the way that _you_ chose, instead of
leaving Access to figure it out for you

Aug 28 '06 #2
Yes, I also tried that (going into External Data, Advanced...) but that
didn't seem to help. I shouldn't need an import spec anyway since the
column headings are the same in the text file as in the database (and
plus, it csv - doesn't get much simpler than that).

Any other ideas?

Aug 28 '06 #3
Not sure this will help at all, but could you post a few records so I
can try to sort out the import? Oh, and include the field types, so I
don't think I have a solution when I really don't.

Aug 28 '06 #4
Sounds damn good, thanks! The data is sensitive to some degree so I'll
change the values slightly and send it on.

thanks!

Aug 28 '06 #5

james wrote:
Sounds damn good, thanks! The data is sensitive to some degree so I'll
change the values slightly and send it on.

thanks!
I'm just interested in data size and type, so munge away. Basically,
keep it accurate enough so folks here can reproduce the problem. (data
types/patterns are the same).

Aug 28 '06 #6
got it...

When creating your Import Spec, go all the way to the end of the "Get
External Data" screen before clicking advanced, then saving the
settings...

thanks.

Aug 28 '06 #7
Yeah, it's one of those features... you have to go all the way through
the wizard before it saves everything. But then everything after that
works a champ.

Aug 29 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Richard Coutts | last post by:
XP & Access 2003 I'm debugging someone elses code that imports a CSV email attachment and appends each record of the file to a table in the database. Everything works great except one entry of...
0
by: Jean | last post by:
Hi everyone, Can someone help me please? I am using a form which imports a .csv file's data into a temporary table called tblQuestImport_csvraw. The problem is that I am working with a German...
0
by: AndrewB | last post by:
Hi Wondering if anyone can help me with a problem this. I am trying to import a fixed-width text file into Access using code (run through Excel) using the following code ...
3
by: holdemfoldem | last post by:
Hi. I'm new to this board and have a few questions about using the method referred to in the topic of this message. I have manually transferred over 1/2 million records from a text file into my...
3
by: Daron | last post by:
I am using this command to import text file: DoCmd.TransferText acImportDelim, str_SpecName, str_TblName, str_FileName, False - The import will always be missing the first line in the text...
1
by: peridian | last post by:
Hello, Used these boards a few times before to find answers, wondered if somebody could help me out. (Using Access 2000, and DAO Reference Library). I have some code which used TransferText to...
4
by: WillMiller | last post by:
Hi, I'm currently attempting to write a small Access Database which carries out the following tasks : 1. Imports Submission files (of a text variety) to a table using TransferText on a daily...
5
by: Dave | last post by:
Hello, I have a possible problem exporting a text field that happens to contain dates (but is not a date field) when using TransferText in MS Access 2000. I am exporting a query to a text...
1
by: PW | last post by:
Hi, When I run the following command, some fields are ending up blank when the clearly have values them in Excel. I have tried converting the columns to general and text. The ones that are...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.