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: 4,391
Default problem with "Refresh BackgroundQuery=False"

The problem may be nothing to do with Excel (hence the generic 1004 error),
but one of the data access layers used to retrive the data. There are 2
error collections associated with data accesss that may be populated
depending on provider etc. See if you get anything useful.

Private Sub CommandButton2_Click()

On Error GoTo Handler

'Change to the name/location of your querytable
ActiveSheet.QueryTables("QT1").Refresh BackgroundQuery:=False

Exit Sub

Handler:
Dim Msg As String
Dim i As Long

Select Case Err.Number
Case 1004
With Application.ODBCErrors
Msg = "ODBC Errors :" & vbNewLine
For i = 1 To .Count
Msg = Msg & .Item(i).ErrorString & vbNewLine
Next
End With

With Application.OLEDBErrors
Msg = Msg & "OLEDB Errors :" & vbNewLine
For i = 1 To .Count
'More info available on OLEDB error if required
Msg = Msg & .Item(i).ErrorString & vbNewLine
Next
End With

Case Else
Msg = "Error Number: " & Err.Number & vbNewLine & Err.Description
End Select

MsgBox Msg

End Sub



"Johnson" wrote in message
...
Hi,
I just want to know if there's error ending up at the code "Refresh
BackgroundQuery=False" and given the error message e.g. error code 1004.
My question's are;
1. What's the reason behined
2. How to fix it.

--
Johnosn



 
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
.Refresh BackgroundQuery:=False ikirin[_6_] Excel Programming 0 June 26th 06 04:01 PM
.Refresh BackgroundQuery:=False ikirin[_5_] Excel Programming 0 June 26th 06 03:46 PM
Problems with .Refresh BackgroundQuery:=False dmplacebo Excel Worksheet Functions 0 July 11th 05 12:39 PM
Web query .Refresh BackgroundQuery:=False problem Jim[_55_] Excel Programming 1 January 26th 05 04:08 PM
Excel does not close from VB!! (when i refresh Refresh query with BackgroundQuery:=False) Anant[_2_] Excel Programming 1 August 6th 03 04:22 AM


All times are GMT +1. The time now is 06:53 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"