Here is my goal: There is a SQL query that needs to be run through our Vertica database. The query changes depending on what inputs the user enters to an excel workbook. I would like to be able to:
- 1. open a connection to our database
2. run a query
3. retrieve those results to populate cells.
Here is the basic code I have been using to just set up my connection:
Code: Select all
Sub DbConnection()
Dim cn As ODBCConnection
Dim strConnect As String
strConnect = "DSN=xxx;UID=xxx;APP=Microsoft Office 2013;DATABASE=xxx;"
cn.Connection = strConnect
cn.Refresh
End Sub
Note: (There is no password for the database)
Thanks in advance for your help.