R
Rdster
Guest
I'm able to establish a connection in another sub and pass it along with the sheet to this sub. This sub will return the correct data.
Public Sub TablePull(wsImport As Worksheet, oCon As Object)
Dim rs As Object, oPost As Object, oUp As Object
Dim iRow As Integer, x As Integer
Dim sSQL As String
Set rs = CreateObject("ADODB.Recordset")
With wsImport
iRow = .Cells(Rows.Count, "A").End(xlUp).Row 'Find the last row of the previously pulled data
If iRow = 3 Then iRow = 4 'If the last row is 3, force it to be 4 so the headers aren't deleted
.Range("A4:G" & iRow).ClearContents 'Clear the contents of the range
sSQL = "SELECT * " & _
"FROM " & .[L1] & " " & _
"WHERE PERIOD = #" & .[D1] & "#"
rs.Open sSQL, oCon, 3, 3 'Opens the connection that was passed in with the SQL statement generated
'above and puts it in a recordset
Application.SendKeys ("~")
'Other code below
End With
End Sub
However, I get prompted to login through the Progress OpenEdge Wire Protocol Driver:
I threw in the SendKeys command in the off chance it might work, but execution never makes it that far. So I'm hoping that there is a way to pass the password (which is null) and have that login bypassed. There may not be a way to do it, even testing the connection in the ODBC setup window I still get the login. I don't see a way to pass or save the password. Any ideas?
Continue reading...
Public Sub TablePull(wsImport As Worksheet, oCon As Object)
Dim rs As Object, oPost As Object, oUp As Object
Dim iRow As Integer, x As Integer
Dim sSQL As String
Set rs = CreateObject("ADODB.Recordset")
With wsImport
iRow = .Cells(Rows.Count, "A").End(xlUp).Row 'Find the last row of the previously pulled data
If iRow = 3 Then iRow = 4 'If the last row is 3, force it to be 4 so the headers aren't deleted
.Range("A4:G" & iRow).ClearContents 'Clear the contents of the range
sSQL = "SELECT * " & _
"FROM " & .[L1] & " " & _
"WHERE PERIOD = #" & .[D1] & "#"
rs.Open sSQL, oCon, 3, 3 'Opens the connection that was passed in with the SQL statement generated
'above and puts it in a recordset
Application.SendKeys ("~")
'Other code below
End With
End Sub
However, I get prompted to login through the Progress OpenEdge Wire Protocol Driver:
I threw in the SendKeys command in the off chance it might work, but execution never makes it that far. So I'm hoping that there is a way to pass the password (which is null) and have that login bypassed. There may not be a way to do it, even testing the connection in the ODBC setup window I still get the login. I don't see a way to pass or save the password. Any ideas?
Continue reading...