Link to home
Start Free TrialLog in
Avatar of afreer2
afreer2

asked on

help parseing data

Begginer
From another EE expert:
Private Sub Command0_Click()

Dim intFilenum As Integer           'watch shows value 1--type interger--always 1
Dim intField As Integer             'watch shows as expected
Dim varArray(0 To 1434) As Variant  'watch shows as expected
intFilenum = FreeFile               'watch shows value 2 --type integer-- always 2
Open "c:\rTemp\aqu0207k\aqu0207.drf" For Input As #intFilenum

Do Until EOF(intFilenum)
  For intField = 0 To 1434
    Input #intFilenum, varArray(intField)
  Next

  'This is where you open your tables or invoke your queries to insert your data

Loop
Close #intFilenum

End Sub
===========================
Doing it this way means that the text fields will be stripped of their quote delimiters
automatically by the Input statement.  I used a zero-origin array for two reasons...
1. it is what the SPLIT() function would produce
2. a recordset's fields collection is zero-based

===========================
I follow some of the code.
What does freefile mean? Why this assignment intFilenum = FreeFile ?
Where are the rows? There should be 70 rows.
SOLUTION
Avatar of stevbe
stevbe

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
1)What does freefile mean? Why this assignment intFilenum = FreeFile ?


FreeFile is a built in VB function that returns a pointer to the Next Free FileHandle - an internal value that serves as the pointer to the file that you are working with.  This value is an Integer, and is then used, along with the # to identify the file, in the statements:

Open "c:\rTemp\aqu0207k\aqu0207.drf" For Input As #intFilenum  ' associates the fiilehandle #intFileNum (or in you case #2 with the physical file ("c:\rTemp\aqu0207k\aqu0207.drf") and opens the handle for Input (so you can read from the file)

Do Until EOF(intFilenum)  ' continues reading from the file until an End-of-file (EOF) is reached
  For intField = 0 To 1434
    Input #intFilenum, varArray(intField)  'Inputs from the file identified by #2,
  Next
  '  you will come to these lines ONCE for each record, so you should the save the varArray or it will be over-writen by the next record
Loop


I assume that you have 1435 separate fields in each of your 70 rows?

AW
I'm running Access 2000 and it allows a maximum of 255 fields in a table.  If indeed you have 1435 fields per record, you are going to have to generate 6 tables to hold the data.
Avatar of afreer2
afreer2

ASKER

I will need some time to understand what you all are showing me.

nico5038
Yes but I will ask another question.

Arthur_Wood
This is a csv file that "BRIS.com" puts out;they put 7-8 tables in one row(which is a horses history along with "todays race"
There will be as many rows as there are horses.

 GRayL
 'This is where you open your tables or invoke your queries to insert your data
This was going to be my next question.

You all answererd the question.
How do you eaperts want the pts devided?
FYI        I'm on 56k speed and I don't stay on line too long(If that makes any difference,slow responces):)

Points should be awarded on a split on the basis of how well the answer helped solve your problem.  If the answers has similar or equal value, award accordingly.  If the lions share was in one answer, and one or two others added a bit, again, award accordingly.  This is one area where you have to do the math ;))

ray
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial