Advertisement
Advertisement
| 05.28.2008 at 12:49PM PDT, ID: 23439387 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: |
Sub ImportToExcel(MyRange As Excel.Range, strConnection As String, strsql As String, blSeverLink As Boolean, Optional varPassword As Variant)
Const strConnect As String = _
"OLEDB;Provider=Microsoft.Jet.OLEDB.4.0;UserID=pferber;Password=ABCDEFG;" & _
"Data Source=C:\ABC.mdb;Persist Security Info=False"
Dim MyQryTbl As QueryTable
On Error GoTo Err
Set MyQryTbl = _
MyRange.Worksheet.QueryTables.Add( _
Connection:=strConnect, _
Destination:=MyRange, sql:=strsql)
'This gap between creating the QueryTable and refreshing it is essential to making sure
'it works. Otherwise, the spreadsheet will often populate with the headers and nothing
'more.
Call MyUniversalClass.Wait(1)
With MyQryTbl
'Note: The false indicates that the refresh is NOT a background query: essential
'for the proper functioning.
.Refresh False
If (blSeverLink) Then
'Keep the data, but release the link to the Access table
.Delete
End If
End With
Sub_Exit:
Exit Sub
Err:
Select Case Err.Number
Case Else:
Call MyUniversalClass.PrintError(Err, "OpenWorkbook")
Resume Sub_Exit
Resume
End Select
End Sub
|