ScriptDude
Programmer
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
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