ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   database calls (https://www.excelbanter.com/excel-programming/381405-re-database-calls.html)

NickHK

database calls
 
If there's no direct ADO/DAO calls, what about QueryTables ?
Run this code to see what you get:

Private Sub CommandButton2_Click()
Dim WS As Worksheet
Dim QT As QueryTable
Dim QTCount As Long

For Each WS In ThisWorkbook.Worksheets
For Each QT In WS.QueryTables
Debug.Print QT.Parent, QT.CommandText
QTCount = QTCount + 1
Next
Next

MsgBox "There are " & QTCount & " query tables in this workbook."

End Sub

NickHK

"Panos Stavroulis." wrote in
message ...
Hi,

I am trying fix an error message from the database coming into excel after
you press a button, ie run a macro. It produces some syntax error on the
database and it fails.

I can see that the button is assigned to a macro, then I can see all

macros
and I've searched through them for opening database connections, ie ADO
calls. I can't see anything connecting to a database. Also profiler on SQL
Server doesn't show anything (maybe the request goes to the wrong server?)

I
can't see any external data queries either.

What else is in an excel file that can make calls to a DBMS? Thanks.

Panos.




Panos Stavroulis.

database calls
 
That worked thanks. I still can't see the queries, something with my odbc
set-up but at least now I can see the sql code. Thanks.

"NickHK" wrote:

If there's no direct ADO/DAO calls, what about QueryTables ?
Run this code to see what you get:

Private Sub CommandButton2_Click()
Dim WS As Worksheet
Dim QT As QueryTable
Dim QTCount As Long

For Each WS In ThisWorkbook.Worksheets
For Each QT In WS.QueryTables
Debug.Print QT.Parent, QT.CommandText
QTCount = QTCount + 1
Next
Next

MsgBox "There are " & QTCount & " query tables in this workbook."

End Sub

NickHK

"Panos Stavroulis." wrote in
message ...
Hi,

I am trying fix an error message from the database coming into excel after
you press a button, ie run a macro. It produces some syntax error on the
database and it fails.

I can see that the button is assigned to a macro, then I can see all

macros
and I've searched through them for opening database connections, ie ADO
calls. I can't see anything connecting to a database. Also profiler on SQL
Server doesn't show anything (maybe the request goes to the wrong server?)

I
can't see any external data queries either.

What else is in an excel file that can make calls to a DBMS? Thanks.

Panos.






All times are GMT +1. The time now is 05:37 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com