Import data from DAT file

  • Thread starter Thread starter Shirley
  • Start date Start date
S

Shirley

How can I import data from DAT file? Currently I open the
DAT file with Notepad and then save it as TXT file. But
now, the DAT file is too big -about 500MB. After I opened
the DAT, I can't save it in TXT format any more because
not enough memory there to carry this action.

I have to process the huge DAT file every month...

Any help is greatly appreciated!

Shirley
 
Shirley said:
How can I import data from DAT file? Currently I open the
DAT file with Notepad and then save it as TXT file. But
now, the DAT file is too big -about 500MB. After I opened
the DAT, I can't save it in TXT format any more because
not enough memory there to carry this action.

I have to process the huge DAT file every month...

Any help is greatly appreciated!

Shirley

You can do something like this. If you know the format of the file,
you write the routine to process cline looking for the character(s)
that delimit each field.

This routine came from a program I wrote that reads a Netscape
formatted e-mail file.

Dim cCR As String

cCR = chr(13)
Open "C:\YourFileName.DAT" For Input As #1

'Loop until end of file
'----------------------
Do While Not EOF(1)
If EOF(1) Then
'Do some processing at end of file
'----------------------------------
Exit Sub
End If

'Read in chars until you reach a line feed
'-----------------------------------------
MyChar = Input(1, #1)
cLine = cLine & MyChar

'If new char is CR process cLine
'-------------------------------
If MyChar = cCR Then

'After processing cLine make cLine null
'--------------------------------------
cLine=""
Loop


HTH
Ron
 
Hi Shirley,

If all you're doing with Notepad is to open the .DAT file and save as
..TXT, try just renaming the file instead. Or see
http://support.microsoft.com/default.aspx?scid=kb;en-us;304206 which
shows how to change the file extensions that Access will accept.

If you have to do other things to the .DAT file before saving as .TXT,
let us know what they are and someone will probably be able to suggest a
way of automating them.
 
Back
Top