Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run-time error 2147217911 Cannot update

Status
Not open for further replies.

ScriptDude

Programmer
Oct 6, 2010
1
US
Hey everyone,

Got a brain teaser here. As you can see in the code below I'm accessing MS Access db on a network via IP address. The IP address is fake in this example but the real connection is working just fine until I try to either add or update records in the table. In this case I'm saving the values of a comma deleminted text file to the table. Works just fine locally. And I do have permissions setup correctly on the host machine. But still I get the nagging Run-time error 2147217911 Cannot update. Database or object is read-only. It occurs at the Rlog.AddNew portion of the code. Should be a piece of cake. What am I missing here? Oh yeah, there are no passwords to deal with, the db is unsecured.


CODE:

Dim Conn As ADODB.Connection
Dim ConStr As String

Set RLog = New ADODB.Recordset
DBPath = "\\111.11.11.111\AccessDB\test\billing\"
CommStrStart = "Provider=Microsoft.jet.oledb.4.0;data source="
DataConn = DBPath & "\CharlotteBillingData.mdb"

Set Conn = New ADODB.Connection
ConStr = CommStrStart & DataConn
Conn.Open (ConStr)
Set cmdDC = New ADODB.Command


Set objFile = CreateObject("Scripting.FileSystemObject")

Dim MyFile, MyFileNew
If IsNull(Me.Text2) Or Me.Text2 = "" Then
MsgBox "You must select a file for import first.", vbOKOnly
Exit Sub
End If

MyFile = Me![Text2]

Set objText = objFile.OpenTextFile(MyFile)

RLog.Open "Select * From tblCoreImportTest", Conn, 3, 3

Do While Not objText.AtEndOfStream
Dim MyDate, MyCustomer, MyChecksFull

strTextLine = objText.Readline
Data = Split(strTextLine, ",")

RLog.AddNew

RLog("fldUnknown") = Data(0) 'Site ID
RLog("fldAccountName") = Data(1) 'Client ID
RLog("CustomerName") = Data(2) 'Client Name

RLog.Update
Loop

'close and erase the file from memory
objText.Close
Set objText = Nothing
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top