473,473 Members | 1,541 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

MS Access menu import not same as TransferText

3 New Member
Hi All,

I'm attempting to automate the import of .txt files into Access.

When I use the File > Get External Data > Import function and select my import specification, the data is imported correctly and in order.

When I use the TransferText macro, and specify all the same paramenters i.e. fixed width, import specification, file path, table name etc, the data is imported; however, it is 'jumbled.' It is not in the same order as the text file (does not import the same way as when I do it manually).

It is critical that the data is imported in the correct order for it to be useful.

Has anyone ever encountered this issue before? Can someone provide some insights?

Many thanks!!!
Apr 27 '07 #1
5 3480
MMcCarthy
14,534 Recognized Expert Moderator MVP
Hi All,

I'm attempting to automate the import of .txt files into Access.

When I use the File > Get External Data > Import function and select my import specification, the data is imported correctly and in order.

When I use the TransferText macro, and specify all the same paramenters i.e. fixed width, import specification, file path, table name etc, the data is imported; however, it is 'jumbled.' It is not in the same order as the text file (does not import the same way as when I do it manually).

It is critical that the data is imported in the correct order for it to be useful.

Has anyone ever encountered this issue before? Can someone provide some insights?

Many thanks!!!
Check your specification file. There may be some problems with it.
Apr 27 '07 #2
bwlee
3 New Member
Check your specification file. There may be some problems with it.
I use the same specification file in TransferText as I do using Menu > import...
Apr 27 '07 #3
MMcCarthy
14,534 Recognized Expert Moderator MVP
I use the same specification file in TransferText as I do using Menu > import...
Check it anyway.
Apr 27 '07 #4
bwlee
3 New Member
Check it anyway.
I've been banging my head against the wall for the past 24 hrs because of this problem. This was seemingly a straightforward task. I've checked and double checked the import specification. As I mentioned before, I use the same one when I import manually as I do for the TransferText macro. Still not sure why the automation method doesn't work properly...
Apr 27 '07 #5
MMcCarthy
14,534 Recognized Expert Moderator MVP
Honestly not sure what is going on here. I've never had this problem. Usually though I use VBA to import text files. You can use code something like the following. It gives better control anyway.
Expand|Select|Wrap|Line Numbers
  1. Function ImportTextFile()
  2. Dim fhandle1 As Integer
  3. Dim fline As String
  4. Dim fPath As String
  5. Dim fld1 As Long
  6. Dim fld2 As Date
  7. Dim fld3 As String
  8. Dim strSQL As String
  9.  
  10.     fpath = "Full path of file.txt"
  11.     ' open the text file to be read
  12.     fhandle1 = FreeFile()
  13.     Open fpath For Input Access Read Lock Write As #fhandle1   
  14.  
  15.     Do While Not EOF(fhandle1) ' loop until you reach the end of the file.
  16.  
  17.         Line Input #fhandle1, fline       
  18.  
  19.         fld1 = Left(fline, 5) 
  20.         fld2 = Mid(fline, 6, 10) 
  21.         fld3 = Left(fline, 16, 30) 
  22.  
  23.         strSQL = "INSERT INTO TableName (Field1, Field2, Field3) " & _
  24.            "VALUES(" & fld1 & ", #" & fld2 "#, '" & fld3 & "')"
  25.         DoCmd.RunSQL strSQL
  26.     Loop
  27.  
  28.     Close #fhandle1
  29.  
  30. End Function
  31.  
Mary
Apr 27 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: Grim Reaper | last post by:
I am importing a .csv file into Access that has 37 fields. My problem is that sometimes the last field only has data at the end of the column (it looks like when you import a file into Access, for...
1
by: D Mat | last post by:
Hi, I'm trying to get MS Access 2000 to automatically import a series of (~200) flat text, tab delimited, data files into a single Access table, with consistent fields and rows. The files have...
2
by: Roald Oines | last post by:
Hi, I'm working on converting several of my Access 97 databases to Access 2002 format (the company's changing from NT 4 to XP and updating Office at the same time), and this one has me stumped....
0
by: matchine | last post by:
This is a recommendation based on my research on an issue with the transfer text functionality. The comments below were from a tech I approched for help. "The transfer text process blocked...
1
by: hedgracer | last post by:
I have a strange problem with a docmd.transfertext statement. I have set up an import specification to transfer in a .txt file by fixed width. When I do the import using the specification the file...
2
by: john | last post by:
I have 400 different Excel-spreadsheetfiles, same structure, all with only one record in it, and all residing in the same folder. Every now and then new Excel files are being added. In my Access...
5
by: Alice | last post by:
I'm trying to upload all .txt files from a specific folder using the following code, but it didn't work. HELP The problem lies in DoCmd.TransferText acImportFixed, "Imperial Import...
3
by: derfer | last post by:
I am trying to import a .inf file into access (the file comes from the output of some 3rd party software). I have managed to convert the file by opeing it in notepad and re-saving then a seperate...
8
by: Irene | last post by:
Hi, I have an MS Access Database with 1 Table containing about 2 million records in Unicode (diferent languages). I would like to export the Table to a Text file (CSV, Tab, etc.) Access...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.