Hello
I had a worksheet that worked great in 2003 but it's not working now in 2010. I figured I would recreate it in 2010.
I have a RawData worksheet which has client visit information (one line of data is one patient visit). I have referral date and assessment date. On the one worksheet I wish to query RawData and pull across the referral and assessment date as long as there is an assessment date.
Skip helped me in the previous project to create an automatic requery using the following code:
This code is now stopping on
Can anyone advise why that would be? What do I need to do to get this to query upon worksheet activation? Why do I get the error message "ODBC Excel Driver Login Failed" when I try to edit the query?
Thanks.
I had a worksheet that worked great in 2003 but it's not working now in 2010. I figured I would recreate it in 2010.
I have a RawData worksheet which has client visit information (one line of data is one patient visit). I have referral date and assessment date. On the one worksheet I wish to query RawData and pull across the referral and assessment date as long as there is an assessment date.
Skip helped me in the previous project to create an automatic requery using the following code:
Code:
Option Explicit
Private Sub Worksheet_Activate()
Dim sConn As String, sSQL As String, sPath As String, sDB As String
sPath = ThisWorkbook.Path
sDB = Split(ThisWorkbook.Name, ".")(0)
sConn = "ODBC;DSN=Excel Files;"
sConn = sConn & "DBQ=" & sPath & "\" & sDB & ".xls;"
sConn = sConn & "DefaultDir=" & sPath & ";"
sConn = sConn & "DriverId=790;MaxBufferSize=2048;PageTimeout=5;"
With ActiveSheet
With .QueryTables(1)
.Connection = sConn
Debug.Print .CommandText
.Refresh False
End With
.Calculate
End With
End Sub
This code is now stopping on
Code:
With .QueryTables(1)
Can anyone advise why that would be? What do I need to do to get this to query upon worksheet activation? Why do I get the error message "ODBC Excel Driver Login Failed" when I try to edit the query?
Thanks.