Re: Update fields in previous row from fields in current row



Hello Graham.

I don't think i can "pull the data in one line at a time". These are the
statements i use to connect to the csv file and put them into a recordset:

casInputFileConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data
Source=" & casInputPathString & ";" & "Extended
Properties=""text;HDR=YES;FMT=CSVDelimited"""

casInputFileRecordset.CursorLocation = adUseClient

casInputFileRecordset.Open "SELECT * FROM [dlcasout.csv]",
casInputFileConnection, adOpenStatic, adLockBatchOptimistic, adCmdText

I got them from Ralph. If you could figure out how to read the lines one at
a time, let me know.

Thanks,
Tony

"argusy" wrote:

Tony Girgenti wrote:
Hello Graham.

I'd like to try to explain what i want to do using the data at the end of
this post.

The data is in a csv file and imported into a recordset. I don't have any
need to update the data source or sort any data. It is simply read into the
recordset. There is no query in the sense that i'm extracting a set of
records from the source. I'm using all the records in the ascii, text, csv
file.

If you look at the data , you can see that the first row has "00050-00-0" as
the first field. The fourth row has "00050-00-0" as the first field. This
constitutes a group of rows in the recordset, four rows.

What i want to do to the recordset is take the "000048815.40" from row four
and put it into the first row after the first comma after the "37.00". So,
after that copy/move, the first row would look like this:

"00050-00-0",,"27202475",037.00,000048815.40,,,Y,Y,N,Y,N

There are other fields i want to move/copy also, but that's not important
here, since the idea here is to get the logic down.

Once the move/copy is done, i want to delete the fourth row then go onto to
the row that has "00050-81-7" and do the same thing. As you can see, that
group consists of only two rows.

I hope this helps you understand what i want to accomplish with the
recordset.

I'm sorry, but the comments you are making just don't seem to apply to what
i need. I hope this does not offend you in any way. I'm just having a hard
time trying to figure out how your comments apply to my problem.

Thanks for all of your help so far.
Tony

"00050-00-0",,"27202475",037.00,,,,Y,Y,N,Y,N
,,"27202490",037.00,,,,Y,Y,N,Y,N
,,"27206490",035.00,,,,Y,Y,N,Y,N
"00050-00-0","FORMALDEHYDE",,,000048815.40 ,000002599 ,00027,,,,,
"00050-81-7",,"12550055",100.00,,,,N,Y,N,N,N
"00050-81-7","L-ASCORBIC ACID",,,000000275.65 ,000000016 ,00027,,,,,
"00056-81-5",,"29950551",100.00,,,,N,Y,N,N,N
,,"56567421",100.00,,,,N,Y,N,N,N
"00056-81-5","GLYCERIN",,,000007163.00 ,000000256 ,00027,,,,,

<snip>

Before my wife drags me off, my suggestion is to pull the data in one line at a
time from the file, push it into a dynamic array of UDTs until your "total" line
arrives, extract the data from that UDT and shove it into the spot you want it,
in the first UDT.
Save the current data (four lines in your example, less the last UDT array)
redim the UDT array, and start on the next group.
I think I see what you're doing - moving the "000048815.40" ( and probably the
"FORMALDEHYDE" as well) into their respective slots in the first line.

UH. OH.. My wife is here, giving me the evil eye!!!

Bye!!!


Graham




.



Relevant Pages

  • Re: Data throughput
    ... The query is used to fill a CSV file that a third party ... >SQL Server MVP ... >> a recordset being returned to the application. ...
    (microsoft.public.sqlserver.odbc)
  • Re: Import comma delimited file
    ... Excel file can be converted into) in good form just as you can to a ... The .csv file needs to be uploaded to the server. ... So I'd suggest going through this recordset one row at a time and within ... ASP Design Tips, ASP Web Database Demo, Free ASP Bar Chart Tool... ...
    (microsoft.public.inetserver.asp.db)
  • Re: Update fields in previous row from fields in current row
    ... The data is in a csv file and imported into a recordset. ... If you look at the data, you can see that the first row has "00050-00-0" as the first field. ... Before my wife drags me off, my suggestion is to pull the data in one line at a time from the file, push it into a dynamic array of UDTs until your "total" line arrives, extract the data from that UDT and shove it into the spot you want it, in the first UDT. ... Save the current data (four lines in your example, less the last UDT array) ...
    (microsoft.public.vb.database.ado)
  • Using Excel to import .csv file into Access table
    ... Using Excel 2003, I need to get a csv file into an Access table. ... Open table as ADO recordset ... Check size of array to confirm field count ...
    (microsoft.public.excel.programming)
  • Re: Working with recordsets
    ... AdSR wrote: ... >> for create an CSV file and the other one is to create a HTML file. ... >> and then when I pass it to the second funtion the recordset is in the ... Or, if this doesn't suit, try creating two separate cursors from the ...
    (comp.lang.python)