martell
01-21-2008, 06:46 PM
dear all,
i have a problem when i want to importing *.txt files into a new table..i have the *.txt's file format like the attachment. the question is, i want the result in the table,between field NO until field amount in one record my table fields is |No|PLU|Desc|QTY |FRAC |Prcs|POT1|POT2|Tax1|tax2|KMS|Amount|
but i have the probelm when i finished the importing the file the result become unstructural..anyone can help me?
regards
boblarson
01-21-2008, 06:52 PM
Since you have lines that alternate with different info you will have to approach it like this post in this thread:
http://www.access-programmers.co.uk/forums/showpost.php?p=639755&postcount=5
martell
01-21-2008, 07:37 PM
dear bob larsson
Dim rst As ADODB.Recordset
Dim strFile As String
Dim strInput As String
Dim varSplit As Variant
Dim intCount As Integer
Set rst = New ADODB.Recordset
' CHANGE THE TABLE NAME HERE
rst.Open "TextImportTest", CurrentProject.Connection, adOpenDynamic, adLockOptimistic
' CHANGE THE TEXT FILE NAME AND LOCATION HERE
strFile = "C:\Temp\D0980.txt"
Open strFile For Input As #1
there is a error said, " the file not found",why whis happened?
thanks
regards
martell
boblarson
01-21-2008, 07:42 PM
The only thing I can think of is that either the path or file name is not exactly right. But, since the file location and file is so simple (in other words, not too long) I'm sure you probably got it right. Just make sure to double check that the file is named with zeroes and not an O (oh) in there somehow by accident.
martell
01-21-2008, 07:57 PM
dear bob,
i'm already change the file name into abc.txt but the error message is still the same..any other way to solve my problem?thanks alot..u're so kind
regards
martell
boblarson
01-21-2008, 08:03 PM
I can't think of anything else. So you have the file abc.txt in the TEMP folder on your C drive?
martell
01-21-2008, 08:06 PM
dear bob,
yeap,i have abc.txt file in my c drive..but it still an error.
regards
martell
boblarson
01-21-2008, 08:23 PM
Not sure what to tell you, except to maybe try using a different folder or drive. I'm at a loss otherwise. I would probably have to actually sit at your computer to figure it out and we both know that isn't going to happen. Sorry I can't think of anything else at this point.