View Full Version : Need Help Importing a DDF File


Gurn
07-01-2004, 10:35 AM
I need some help importing a DDF file into a table... The file looks something like this:
|
3000

0000


5005B
177.033

5025
5.089

5026
4.000

5028
3.040

5035B
330.739

5044
338.538

5046B
160.001

5135S
387.988

5320B
360.736

5031S
237.837

|
These would be 2 different fields (1)Product Number and (2) weight I have no idea how to seperate by the return and filter out the blank space...
Any help would be appreciated greatly!!!!!!!!
Thanks,
gurn :confused:

WayneRyan
07-01-2004, 09:25 PM
Gurn,

In the long run, it would help if you inherited data
in a better format, but sometimes you have to go with
what you have.

Hope this gets you started.


Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Dim strBuf As String

Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("YourTable")
Open "C:\SomeFile.dat" For Input As #1

Line Input #1, strBuf
While Not EOF(1)
rst.AddNew
Line Input #1, rst!Product
Line Input #1, rst!Weight
rst.Update
Line Input #1, strBuf <-- Ignore white space
Wend
Close #1


Wayne

Gurn
07-15-2004, 01:20 PM
Yup that was the right direction Thanks!!!!!
gurn