473,395 Members | 1,622 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,395 software developers and data experts.

FYI - Issue with TransferText in Access - VBA

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 after importing 6139 records each
time on my side. After further research, there maybe a memory leak in
TransferText. When the number of records exceeds its limitation, the
transfer process blocked. Therefore, please abandon TransferText and
write own code to read text file line by line."

I was writing code to continually monitor a folder and import any text
files. Below is the recommended solution. Works much more quickly,
although the memory use still seems to reach extremely high levels when
left running for extended periods of time.

J
Private Sub ProcessFrame_Click()
'procedure to import all files in a directory and delete them.
'assumes they are all the correct format for an ASCII delimited import.

Dim ErrCounter
On Error GoTo Err_Errorclear

mfquit = False
Me![CurrentStatus] = "Processing..."
Me![ESCMessage] = "Press ESC to Halt Message Processing."

StartProcess:
Do While Me![ProcessFrame] = 1 And mfquit = False

'Allow keystokes to process
DoEvents

Dim strFldr As String
Dim strFile As String
Dim intInputData As Integer
Dim rst1 As ADODB.Recordset

Dim fl As Long
Set rst1 = New ADODB.Recordset
rst1.Open "tblRawBroadcastMessage", CurrentProject.Connection,
adOpenKeyset, adLockOptimistic

Dim MyChar As String
Dim MyString As String

strFldr = Me![ImportFolderDest]
strFile = Dir(strFldr)
intInputData = FreeFile()

If Len(strFile) > 0 Then
Open Me![ImportFolderDest] & strFile For Input As #intInputData
Do While Not EOF(intInputData) ' Loop until end of file.
rst1.AddNew
f1 = LOF(intInputData)

MyChar = Input(f1, #intInputData) ' Get one character.
rst1("Message") = MyChar
rst1.Update
Loop
'delete the file (consider moving it to an Archive folderinstead.)
Close #intInputData
FileCopy Me![ImportFolderDest] & strFile, Me![ProcessFolderDest] &
strFile
Kill Me![ImportFolderDest] & strFile

strFile = ""

rst1.Close
Set rst1 = Nothing
End If

'If there is more than one days worth of production in table on Monday,
export archive file and clear table (files older than 7 days)
If Weekday(Now) = 2 Then
If DCount("[DateCreated]", "tblRawBroadcastMessage",
"[DateCreated]<>null") > 37350 Then
mydate = Now
DoCmd.TransferText acExportFixed, "ExportTextSpec",
"qryExportText", "C:\BroadcastProcessing\SCE Messages\Archive\" &
Me![SystemName] & "-EBroadcastArchive-" & Format(mydate, "yyyymmdd") &
".txt", False, ""
DoCmd.SetWarnings False
DoCmd.OpenQuery "qryDeleteData"
DoCmd.SetWarnings True
End If
End If
Loop
Me![ProcessFrame] = 0
MsgBox "Process Cancelled. Messages will not be Imported.", vbCritical
Me![CurrentStatus] = "Process Cancelled!"
Me![ESCMessage] = ""
GoTo EndProcess

Err_Errorclear:
Err.Clear
Resume StartProcess
EndProcess:
End Sub

Feb 15 '06 #1
0 1391

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

Similar topics

6
by: Vladislav Moltchanov | last post by:
I have discovered a couple of years ago, that import with DoCMD.TransferText for CSV text file doesn’t work in Acc2000, while it works perfectly in ACC97. which has been discussed on this...
4
by: axelleforever | last post by:
Bonjour, La première colonne de mon fichier texte (séparateur points-virgules) contient des valeurs alphanumériques (1,2a,3u etc). Je constate que seules les valeurs numériques sont importées...
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: Oliver Gabriel | last post by:
Hi, i want to export a table for later import, using vba. That´s my code: export: filename = "C:\HVOtabelle.txt"
2
by: carrionk | last post by:
Hi I'm trying to export an ADO Recordset generated at Runtime to a txt file. I know that you have two options for exporting Access information: 1) TransferText 2) Reading / Writing Text...
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: Ryan | last post by:
Hello. I was hoping that someone may be able to assist with an issue that I am experiencing. I have created an Access DB which imports an Excel File with a particular layout and field naming. ...
0
by: Sean Howard | last post by:
I have a strange problem linking tab delimited text files in Access 2000 (I am running Windows XP), please try this and let me know if I am going mad. Step 1. Create the tab-delimited text...
7
ollyb303
by: ollyb303 | last post by:
Hi, I am having a bit of a problem with TransferText macro. I am using TransferText, Export Delimited (no field names) to export the results of a query as a .csv file. The query is based on...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...

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.