LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel 2003 with SP" 1004 error


Help me please.

In a workbook I have the following sub that retrieves data from an
Access table into tha "RFest" range of the "festivi" sheet. I have no
error using Office 2003 Professional with SP3. I get, instead, the
following error with Office 2003 Professional SP2

Applicatione or object defined error/1004

on the statements
TargetRange.cells(1, intColIndex+1).Value =
TargetRange.cells(2, 1).CopyFromRecordset rs

However, I cannot to update to SP£ since my Company has not released it
since incompatible with other applications.

Any tip to solve such error without the SP3 upgrade?

Sub ADOImport(TableName As String, drecup As String)
Dim cn As ADODB.Connection, rs As ADODB.Recordset, appath As
String
Dim intColIndex As Integer,TargetRange As Range, ws as worksheet
Dim CID As Long, SQLstr As String, anno As Integer
On Error GoTo err_hnd
set ws=Worksheets("Festivi")
set TargetRange=ws.range("RFest")
Call ScopriRighe
appath = ThisWorkbook.Path & "\"
CID = Range("1Trim!H56").Value
anno = Range("1Trim!AO1").Value

' apre il database
Set cn = New ADODB.Connection
With cn
Provider = "Microsoft.jet.OLEDB.4.0"
Properties("Data Source") = appath & "festivi.mdb"
Properties("Jet OLEDB:Database Password") = PWORD
Open
End With

Set rs = New ADODB.Recordset

SQLstr = ..omessa per semplicità

With rs
Open SQLstr, cn, , , adCmdText
For intColIndex = 0 To rs.Fields.Count - 1 ' nomi dei campi
' l'errore avviene sull'istruzione seguente
' Errore definito dall'applicazione o dall'oggetto /1004
TargetRange.cells(1, intColIndex+1).Value =
rs.Fields(intColIndex).Name
Next
TargetRange.cells(2, 1).CopyFromRecordset rs
End With
rs.Close
Set rs = Nothing
cn.Close
Set cn = Nothing
Set TargetRange = Nothing
set ws=Nothing
Exit Sub
err_hnd:
MsgBox Err.Description & "/" & Err.Number & " Sub ADOImport"
Resume Next
End Sub

Thanks, Emiliano


--
eggpap

Excel 2003 on Vista HP System - can use VBA
------------------------------------------------------------------------
eggpap's Profile: http://www.thecodecage.com/forumz/member.php?userid=90
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=77743

 
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
run time error 1004 general odbc error excel 2003 vba Mentos Excel Programming 5 January 24th 11 02:56 PM
Hiding Rows Error - "Runtime Error 1004 - Unable to set the hidden property of the range class" Punsterr Excel Programming 2 April 9th 07 05:32 PM
Run-time error '1004' VBA Excel 2003 pltang Excel Programming 1 July 19th 06 11:15 PM
Chart.Export error '1004' after upgrade to Excel 2003 Marsel Excel Programming 0 December 17th 05 12:20 PM
Excel 2003 Macro Error - Runtime error 1004 Cow Excel Discussion (Misc queries) 2 June 7th 05 01:40 PM


All times are GMT +1. The time now is 10:28 PM.

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"