Run-time error '1004' general odbc error

  • Thread starter sike11 via OfficeKB.com
  • Start date
S

sike11 via OfficeKB.com

I have the following macro that was created and used by a previous user. I am
new to the organisation and the macro worked fine for him and all my other
colleagues. However, this does not work for me.

Sub GETdata_HT()

Sheets("HT").Select
ClearColumns

With ActiveSheet.QueryTables.Add(Connection:=Array(Array( _

"ODBC;DSN=InspectionOutputDB;Description=RAISQL2;UID=rsasso;APP=Microsoft
Office 2003;WSID=DES00002;DATABASE=InspectionOutputDB;Trusted_Con" _
), Array("nection=Yes")), Destination:=Range("A1"))
.CommandText = Array( _
"SIS_HT '" & Worksheets("TITLES").Range("B12").Value & "', '" & Worksheets
("TITLES").Range("C12").Value & "' " _
)
.Name = "HT"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.PreserveColumnInfo = True
.Refresh BackgroundQuery:=False
End With
End Sub


the .Refresh BackgroundQuery:=False is highlighted and I am at a loss as to
why it works for everybody else but me. Please help. I am at my wits end.

Mary.
 
P

Patrick Molloy

this looks odd

Office 2003;WSID=DES00002;DATABASE=InspectionOutputDB;Trusted_Con" _
), Array("nection=Yes")), Destination:=Range("A1"))
.CommandText = Array( _

trusted_connection ... not broken up as it appears.
 
S

sike11 via OfficeKB.com

The main thing is that it works for my colleagues but not for myself.

Patrick said:
this looks odd

Office 2003;WSID=DES00002;DATABASE=InspectionOutputDB;Trusted_Con" _
), Array("nection=Yes")), Destination:=Range("A1"))
.CommandText = Array( _

trusted_connection ... not broken up as it appears.
I have the following macro that was created and used by a previous user. I
am
[quoted text clipped - 37 lines]
 
S

sike11 via OfficeKB.com

I have managed to resolve this. I found that the query calls a stored
procedure which I do not have access to. Once I was given permission, the
macro run without any problems.

The main thing is that it works for my colleagues but not for myself.
this looks odd
[quoted text clipped - 9 lines]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top