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! 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
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?
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.
Sounds damn good, thanks! The data is sensitive to some degree so I'll
change the values slightly and send it on.
thanks!
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).
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.
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. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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...
|
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...
|
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
...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
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
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
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...
|
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...
| |