472,353 Members | 2,059 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

TransferText method msaccess - Imported table corrupted

Hi,
I'm trying to import some text files in a simple access table, but
sometimes it miss some rows after import.
here is the code:
Public Function OpenMyApplicationData() As Boolean
Dim Upid As Boolean
Dim LastBD As Integer
Dim dbs As Database
Dim fileN As String
Dim tableN As String
Set dbs = CurrentDb
On Error GoTo Err_OpenMyApplicationData
Dim strMyApplicationDataFile As String
Dim strExitMessage As String
'windows common dialog- open file mode
strMyApplicationDataFile = OpenSaveCommonDialog("Open",
GetAppDir() & "MyDataSubdirectory", _
"Open MyApplication Data Files", "",
"MyApplication Data Files(*.txt)", "*.txt")
LastBD = find_last(strMyApplicationDataFile, "\")
fileN = "#" + Mid(strMyApplicationDataFile, LastBD + 1)
tableN = Mid(strMyApplicationDataFile, LastBD + 1,
Len(Mid(strMyApplicationDataFile, LastBD + 1)) - 4)
'test response
If (strMyApplicationDataFile = "") Then
OpenMyApplicationData = False
strExitMessage = "Attempt to open MyApplication Data Files
cancelled."
Else
'import the text file
OpenMyApplicationData = True
strExitMessage = ""
dbs.Execute ("DELETE * FROM pivoti;")
DoCmd.TransferText acImportFixed, "ImpSpec", "pivoti",
strMyApplicationDataFile, False
dbs.Execute ("DELETE * FROM pivoti WHERE field1 = '' or
field1 is NULL;")
' dbs.Execute ("UPDATE pivoti set ID=count(*);")
dbs.Execute ("INSERT INTO pivoti (ID,field1) values (1,'" +
fileN + "');")
Upid = Update_ID
dbs.Execute ("loadprop")
MsgBox "Table loaded correctly!"

End If
Exit_OpenMyApplicationData:
If Not (OpenMyApplicationData) Then
MsgBox strExitMessage, vbInformation, "MyApplication Software"
End If
Exit Function

Err_OpenMyApplicationData:
'on error fail the function
OpenMyApplicationData = False
strExitMessage = "Error during attempt to open MyApplication
Data Files (error# " & Err.Number & " " & Err.Description & ")"
Resume Exit_OpenMyApplicationData
End Function

the missing part (example)
SYMPATHIE=Simpatia <--- imported
#AccountInterestFeesCharges.jsp

#ACCOUNT_CHARGES
LIBCHARGES=SPESE
AVIS=Avviso
RELEVES=Estratti conto
MOUVEMENTS=Movimenti
EXTRAITS=Estratti
ANNUEL=Annuali
BOUCLEMENT=Chiusura processo
CDG=CDG
COM_BOUCLEMENT=Commissioni su chiusura processo
COM_MOUVEMENT=Commissioni su movimenti
APPL_TARIF=Prezzo applicato
Y/N=Y/N* (*:Par defaut)
YN = Y/N* (*:Par defaut)

#ACCOUNT_FEES
LIBFEES=Commissioni su chiusura processo
SANS=Senza
DEBITMAX=Addebito massimo
DEBITMOY=Addebito medio
TOTALDEB=Totale addebiti
MARGEPLFD=Margine massimo
PLAFOND=Su massimo
DEPASPLFD=Massimo superato
METHODE=Metodo 5+6
CREDITMOY=Accredito medio

#ACCOUNT_INTERESTS <---- imported

thank you for helping
regards

Nov 13 '05 #1
0 1130

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...
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"
0
by: Richard Beacroft | last post by:
Trying to write a C# Windows App to export all objects and content from 2 MSAccess 97 databases for comparison analysis. very little...
12
by: ckirby | last post by:
I've got a csv that I am trying to import into a SQL Server (2000) table through an adp (Access 2000). The form used gives the user the ability to...
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...
3
by: Jim M | last post by:
I am trying to 'grab' a backend data path and filename from a text file (to be used when updated front ends are installed by users). I store this...
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...
5
by: bwlee | last post by:
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...
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...
1
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS...

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.