Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 88
Default ADO connection Problems between excel worbooks

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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems with ADO connection to same workbook? Tim Lund[_2_] Excel Programming 1 March 14th 07 04:23 PM
Problems with listboxes in connection with screenupdating = false Mats Nilsson Excel Programming 0 November 27th 06 03:11 PM
Cycling through all worbooks in a folder Ben Excel Programming 5 March 15th 06 10:38 AM
Opening worbooks with a variable file name. ibbm Excel Programming 5 January 5th 06 02:58 AM
Clarification on "Application.Worbooks.Count" proceedure Les Stout[_2_] Excel Programming 8 November 2nd 05 07:12 PM


All times are GMT +1. The time now is 07:06 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"