PC Review


Reply
Thread Tools Rate Thread

ADO connection Problems between excel worbooks

 
 
leerem
Guest
Posts: n/a
 
      27th Apr 2010
I need your assistance once again.

I have a workbook that needs to be updated from a distant PC. I believe this
can be achieved vai ADO. I'm totaly new to ADO so please bear with me.
I need to access the information on a workbook named 'New Inload Final.xlsm'
Sheets("Entry") which has been Mapped to the Z:/ drive. I have been able to
compile the attached code which I have gained through books etc, but i get
the error 'Cannot update. Database or object is read-only.'

Idealy I'd like to say access the worksheet for analytical reasons wherby by
reports can be risen based on the information contained within the sheet,
allowing for the distant PC to be updated by the User, which will then in
turn update my workbook reports. Can this be achieved.

My Code to create connection.

Public Sub QueryWorksheet()
Dim rst As ADODB.Recordset
Dim Connectionstring As String

Connectionstring = _
"Provider=Microsoft.jet.OLEDB.4.0;" & "Data Source=" _
& "D:\Store Returns\Data\CurData.xlsm;" & "Extended Properties=Excel 8.0;"

Dim SQL As String

'Query based on the Worksheet name

SQL = "Select * FROM [Sheet1$]"

Set rst = New ADODB.Recordset

On Error GoTo CleanUp

Call rst.Open(SQL, Connectionstring, _
CursorTypeEnum.adOpenForwardOnly, LockTypeEnum.adLockReadOnly, _
CommandTypeEnum.adCmdText)

Call Sheet1.Range("A1").CopyFromRecordset(rst)

CleanUp:
Debug.Print Err.Description

If (rst.State = ObjectStateEnum.adStateOpen) Then
rst.Close
End If

Set rst = Nothing
End Sub

Can anyone point me in the correct direction please.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Linking Worbooks potter.justin@gmail.com Microsoft Excel Discussion 1 30th Sep 2006 11:14 PM
Cycling through all worbooks in a folder =?Utf-8?B?QmVu?= Microsoft Excel Programming 5 15th Mar 2006 10:38 AM
MERGE TWO DIFFERENT WORBOOKS? =?Utf-8?B?SE9VU1RPTg==?= Microsoft Excel Misc 4 5th Sep 2004 01:55 AM
Re: Can no longer open saved worbooks Suzanne S. Barnhill Microsoft Word Document Management 0 18th Aug 2004 11:01 PM
Updating different worbooks to workbook aggi Microsoft Excel New Users 1 16th Jul 2004 04:34 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:26 AM.