From: Daron on
I need to update a text file.

My current attempt is to create a recordset from the text file, which
I am thinking I would have to disconnect to make it updatable. Here is
my code sample:

sql_Regents = "SELECT * FROM [" & str_PlanName & ".csv]"

'Connect to the text file, and create our base RecordSet
Set rs_regents = CreateObject("ADOR.RecordSet")
rs_regents.Open sql_Regents, strCon', adOpenForwardOnly,
adLockBatchOptimistic

'disconnect the recordset to update it
Set rs_Regents.ActiveConnection = Nothing

str_PlanName & ".csv" is an existing file. I get the following error
at the "Set rs_Regents.ActiveConnection = Nothing" line:
From: McKirahan on
"Daron" <Daron.Lowell(a)gmail.com> wrote in message
news:9b487a20-a038-45bb-9328-fe931858c886(a)34g2000hsf.googlegroups.com...
> I need to update a text file.
>
> My current attempt is to create a recordset from the text file, which
> I am thinking I would have to disconnect to make it updatable. Here is
> my code sample:
>
> sql_Regents = "SELECT * FROM [" & str_PlanName & ".csv]"
>
> 'Connect to the text file, and create our base RecordSet
> Set rs_regents = CreateObject("ADOR.RecordSet")
> rs_regents.Open sql_Regents, strCon', adOpenForwardOnly,
> adLockBatchOptimistic
>
> 'disconnect the recordset to update it
> Set rs_Regents.ActiveConnection = Nothing
>
> str_PlanName & ".csv" is an existing file. I get the following error
> at the "Set rs_Regents.ActiveConnection = Nothing" line:

Why use a recordset to update a text file.

Why not use the FileSystemObject.

How are you updating it -- adding,changing, deleting lines?


From: Daron on
On Jun 25, 2:46 pm, "McKirahan" <N...(a)McKirahan.com> wrote:
> "Daron" <Daron.Low...(a)gmail.com> wrote in message
>
> news:9b487a20-a038-45bb-9328-fe931858c886(a)34g2000hsf.googlegroups.com...
>
>
>
> > I need to update a text file.
>
> > My current attempt is to create a recordset from the text file, which
> > I am thinking I would have to disconnect to make it updatable. Here is
> > my code sample:
>
> > sql_Regents = "SELECT * FROM [" & str_PlanName & ".csv]"
>
> > 'Connect to the text file, and create our base RecordSet
> > Set rs_regents = CreateObject("ADOR.RecordSet")
> > rs_regents.Open sql_Regents, strCon', adOpenForwardOnly,
> > adLockBatchOptimistic
>
> > 'disconnect the recordset to update it
> > Set rs_Regents.ActiveConnection = Nothing
>
> > str_PlanName & ".csv" is an existing file. I get the following error
> > at the "Set rs_Regents.ActiveConnection = Nothing" line:
>
> Why use a recordset to update a text file.
>
> Why not use the FileSystemObject.
>
> How are you updating it -- adding,changing, deleting lines?

I am updating sets of the records. I need to be able to filter out
certain sets of the records based on a date field, update those
records, and then go on to the next filtered subset.

I could walk thru the file line-by-line, but with potentially 10's of
thousands of records, and multiple files, I am hoping that using a
recordset would be faster.

Does this help?
From: McKirahan on
"Daron" <Daron.Lowell(a)gmail.com> wrote in message
news:152c3dbd-b5fa-475b-bd57-b514c032094d(a)r66g2000hsg.googlegroups.com...
> On Jun 25, 2:46 pm, "McKirahan" <N...(a)McKirahan.com> wrote:
> > "Daron" <Daron.Low...(a)gmail.com> wrote in message
> >
> > news:9b487a20-a038-45bb-9328-fe931858c886(a)34g2000hsf.googlegroups.com...
> >
> >
> >
> > > I need to update a text file.
> >
> > > My current attempt is to create a recordset from the text file, which
> > > I am thinking I would have to disconnect to make it updatable. Here is
> > > my code sample:
> >
> > > sql_Regents = "SELECT * FROM [" & str_PlanName & ".csv]"
> >
> > > 'Connect to the text file, and create our base RecordSet
> > > Set rs_regents = CreateObject("ADOR.RecordSet")
> > > rs_regents.Open sql_Regents, strCon', adOpenForwardOnly,
> > > adLockBatchOptimistic
> >
> > > 'disconnect the recordset to update it
> > > Set rs_Regents.ActiveConnection = Nothing
> >
> > > str_PlanName & ".csv" is an existing file. I get the following error
> > > at the "Set rs_Regents.ActiveConnection = Nothing" line:
> >
> > Why use a recordset to update a text file.
> >
> > Why not use the FileSystemObject.
> >
> > How are you updating it -- adding,changing, deleting lines?
>
> I am updating sets of the records. I need to be able to filter out
> certain sets of the records based on a date field, update those
> records, and then go on to the next filtered subset.
>
> I could walk thru the file line-by-line, but with potentially 10's of
> thousands of records, and multiple files, I am hoping that using a
> recordset would be faster.
>
> Does this help?

A Google of "ado csv recordset update" I found these links:
http://forums.devx.com/showthread.php?t=46068
<UR:http://www.eggheadcafe.com/forumarchives/VisualBasicdatabaseado/Nov2005/
post24246438.asp>

If not look into disconnected recordsets...


From: Daron on
On Jun 25, 4:07 pm, "McKirahan" <N...(a)McKirahan.com> wrote:
> "Daron" <Daron.Low...(a)gmail.com> wrote in message
>
> news:152c3dbd-b5fa-475b-bd57-b514c032094d(a)r66g2000hsg.googlegroups.com...
>
>
>
> > On Jun 25, 2:46 pm, "McKirahan" <N...(a)McKirahan.com> wrote:
> > > "Daron" <Daron.Low...(a)gmail.com> wrote in message
>
> > >news:9b487a20-a038-45bb-9328-fe931858c886(a)34g2000hsf.googlegroups.com....
>
> > > > I need to update a text file.
>
> > > > My current attempt is to create a recordset from the text file, which
> > > > I am thinking I would have to disconnect to make it updatable. Here is
> > > > my code sample:
>
> > > > sql_Regents = "SELECT * FROM [" & str_PlanName & ".csv]"
>
> > > > 'Connect to the text file, and create our base RecordSet
> > > > Set rs_regents = CreateObject("ADOR.RecordSet")
> > > > rs_regents.Open sql_Regents, strCon', adOpenForwardOnly,
> > > > adLockBatchOptimistic
>
> > > > 'disconnect the recordset to update it
> > > > Set rs_Regents.ActiveConnection = Nothing
>
> > > > str_PlanName & ".csv" is an existing file. I get the following error
> > > > at the "Set rs_Regents.ActiveConnection = Nothing" line:
>
> > > Why use a recordset to update a text file.
>
> > > Why not use the FileSystemObject.
>
> > > How are you updating it -- adding,changing, deleting lines?
>
> > I am updating sets of the records. I need to be able to filter out
> > certain sets of the records based on a date field, update those
> > records, and then go on to the next filtered subset.
>
> > I could walk thru the file line-by-line, but with potentially 10's of
> > thousands of records, and multiple files, I am hoping that using a
> > recordset would be faster.
>
> > Does this help?
>
> A Google of "ado csv recordset update" I found these links:http://forums.devx.com/showthread.php?t=46068
> <UR:http://www.eggheadcafe.com/forumarchives/VisualBasicdatabaseado/Nov2005/
> post24246438.asp>
>
> If not look into disconnected recordsets...

That is what the original post is about, an error with the
disconnected recordset. I would still appreciate help on this error if
possible.

I will look at the links suggested as well.
 | 
Pages: 1
Prev: Renaming files
Next: update text file