Hello, everyone,
I'm trying to update a comma delimited text file using ADO. I am able to connect to it and do everything I need to it except update one of the fields.
The same code works in every thing else I use it to update except text files.
The error I'm getting is:
err.Number
-2147467259
err.Description
Updating data in a linked table is not supported by this ISAM.
Here is my code:
VB Code:
Option Explicit Sub Main() Dim X As Long Dim cn As New ADODB.Connection Dim rs As New ADODB.Recordset Dim strPath As String Dim strSQL As String strSQL = "SELECT * FROM temp2.txt" strPath = "G:\share\credit\Credit MIS\MIS Secure\" DoCmd.Hourglass True cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=G:\share\credit\Credit MIS\MIS Secure\;Extended Properties=""text;HDR=Yes;FMT=Delimited""" rs.Open strSQL, cn, adOpenKeyset, adLockOptimistic DoCmd.Hourglass False Do Until rs.EOF X = X + 1 If Format(rs!CallDT, "hh:mm:ss") >= "00:00:00" And Format(rs!CallDT, "hh:mm:ss") < "04:00:00" Then rs!CallDT = Format(rs!CallDT, "Short Date") - 1 rs.Update Else rs!CallDT = Format(rs!CallDT, "Short Date") rs.Update End If rs.MoveNext Loop rs.Close cn.Close Set rs = Nothing Set cn = Nothing End Sub
So you know, I've also tried opening the recordset using these three methods:
VB Code:
rs.Open strSQL, cn, adOpenDynamic, adLockOptimistic rs.Open strSQL, cn, adOpenKeyset, adLockOptimistic rs.Open strSQL, cn, adOpenDynamic, adLockOptimistic
What am I doing wrong?
Thanks in advance!
Strick


Reply With Quote
