PDA

View Full Version : VBA excel access sharepoint slow connection



hakonte
03-05-2015, 03:36 PM
I have an excel sheet that inputs data into a Access database that is on a sharepoint server. This works fine in Romania, Singapore, Norway and Vietnam, but not from Brazil! The connection in Brazil is very slow. The user has been given the correct access in shrarepint. Does anyone have ANY idea? I dont get up any error msg, it looks like it updates, but it doesnt! The code goes like this:


Sub SaveToDB()
Dim ark As String
Dim oConn As Object
'Dim oConn As ADODB.Connection
Set oConn = CreateObject("adodb.connection")
Dim rs As Object
Set rs = CreateObject("adodb.recordset")
StrDBPath = "J:/correct_DB.accdb"
sConn = "Provider=Microsoft.ACE.OLEDB.12.0;" & "Data Source=" & StrDBPath ' & "; Jet OLEDB:Database password = 'Vard2005'"
Set oConn = New ADODB.Connection
Set rs = New ADODB.Recordset
oConn.Open sConn
rs.Open "tblREC", oConn, adOpenKeyset, adLockOptimistic, adCmdTable
LagreREC rs
rs.Close
oConn.Close
End Sub

Sub LagreREC(rs)
Dim ark As String
Dim i As Integer
i = 1
ark = "Receivables"
With rs
For i = 1
If Left(Sheets(ark).Cells(i, Range("REC_company").Column).Formula, 1)
if Range("REC_company").Column)) = True Then
.AddNew
.Fields("Report_period") = Range("Report_period")
.Update
End If
end if
End With
End Sub