Today I've been trying out a personal project I have been interested in for a while. MS Access 2000.
I get a daily list of currency exchange rates via email, but it's a bit of a pain to go through them and extract the few I need, and I don't keep up on it very well! However, I did determine that the actual message files are nice and readable as plain text (I still use Eudora 7). So I thought it might be possible to write a bit of VBA code to do it for me.
I found a Bytes thread that gave the essential principles of the import process:
How to get external data into a table/form
Unfortunately, I have discovered that Access gives up and walks away when it hits a carriage return-linefeed combination. Not only does it stop importing; it doesn't execute any of the rest of the code, so it is not even closing my file or my recordset.
Any way I can tell it to just plow ahead? A couple of my unsuccessful ideas are in the code excerpt below.
If all goes well, I might spend less time on this programming project than it would take to manually extract a few hundred values. ;-)
I get a daily list of currency exchange rates via email, but it's a bit of a pain to go through them and extract the few I need, and I don't keep up on it very well! However, I did determine that the actual message files are nice and readable as plain text (I still use Eudora 7). So I thought it might be possible to write a bit of VBA code to do it for me.
I found a Bytes thread that gave the essential principles of the import process:
How to get external data into a table/form
Unfortunately, I have discovered that Access gives up and walks away when it hits a carriage return-linefeed combination. Not only does it stop importing; it doesn't execute any of the rest of the code, so it is not even closing my file or my recordset.
Any way I can tell it to just plow ahead? A couple of my unsuccessful ideas are in the code excerpt below.
Code:
Open strFile For Input As #1 'Open file for input.
Do While Not blnTheEnd 'Loop until end of file.
Line Input #1, strLine 'Reads the row within the file.
'If strLine = (Chr(13) + Chr(10)) Then
' strLine = ""
'End If
If strLine = "!-!-!REALLY THE END OF THE FILE!-!-!" Then
blnTheEnd = True
Else
rs.AddNew
rs(0) = strLine
rs.Update 'Writes data into the table.
End If
Loop
Close #1 'Close file.
rs.Close 'Close what you opened.
Comment