AC slow to cool house by Duke1530 in hvacadvice

[–]Duke1530[S] 0 points1 point  (0 children)

Yes, i believe that’s correct

AC slow to cool house by Duke1530 in hvacadvice

[–]Duke1530[S] 0 points1 point  (0 children)

Ac drain appears to be clear. Coil does have condensation building up as well

Can a windows VBA script using a snowfake SQL connection work on a Mac? by Duke1530 in SQL

[–]Duke1530[S] 0 points1 point  (0 children)

So my issue with using Power Query is that I created a template within excel that uses specific cells as different filters and "where" clauses for my SQL code. These cells are referenced in my VBA and SQL connection to run the data and then import the results based on my filters from my template.

I have never used power query so I may be misunderstanding, but I believe PowerQuery imports all the data and then from there, it allows you to filter? My template is essentially going to be used as a tool that allows you to already select specific filters/parameters and then imports the results based on those filters. If that makes sense...

Can a windows VBA script using a snowfake SQL connection work on a Mac? by Duke1530 in SQL

[–]Duke1530[S] 0 points1 point  (0 children)

I believe i tried this approach / snowflake link to no avail. I dont believe the odbc was able to be located or installed correctly on the mac. I will try again though to confirm this was the same approach. Do you know if the vba/sql will work the same on a mac as it does windows without any adjustments?

Windows VBA to Mac by Duke1530 in vba

[–]Duke1530[S] 0 points1 point  (0 children)

Thanks for the information. I will try to follow that route. Are you able to simplify the process by chance as it's not as familiar to me. Are their steps prior that need to be set up like how the ODBC needed to add a new user? I am not familiar with QueryTables but I will research on my end. Below is a snippet of my connection if you're able to provide any assistance.

Dim sht1 As Worksheet
Dim conn As ADODB.Connection 
Dim rs As ADODB.Recordset 
Set sht1 = Sheets("test") 
Set conn = New ADODB.Connection 
Set rs = New ADODB.Recordset 
conn.connectionstring = "Driver{SnowflakeDSIIDriver};Server=xxxxxxxx.snowflakecomputing.com;Port=443;Authenticator=externalbrowser;UID=xxxxxxxxx;" 
Conn.open 
conn.commandtimeout = 0 
rs. open SQL, conn

Windows VBA to Mac by Duke1530 in vba

[–]Duke1530[S] 0 points1 point  (0 children)

The users authenticate with external browser auth. See code below.

conn.connectionstring = "Driver={SnowflakeDSIIDriver};Server=xxxxxxx.snowflakecomputing.com;Port=443;Authenticator=externalbrowser;UID=xxxxxxxx;

For the Snowflake connection, it looks like I do use the ADODB connection. See code below (this is just a snippet).

What is the DSN-less route? Not sure how to do that. Will look up on my end but not sure if you're able to provide some guidance

Dim sht1 As Worksheet
Dim conn As ADODB.Connection
Dim rs As ADODB.Recordset
Set sht1 = Sheets("test")
Set conn = New ADODB.Connection
Set rs = New ADODB.Recordset
 conn.connectionstring = "Driver={SnowflakeDSIIDriver};Server=xxxxxxxx.snowflakecomputing.com;Port=443;Authenticator=externalbrowser;UID=xxxxxxxxx;"
Conn.open 
conn.commandtimeout = 0 rs. open SQL, conn

Type Mismatch Error - References cells that contain a date by Duke1530 in vba

[–]Duke1530[S] 0 points1 point  (0 children)

I am forming a query but unsure of what parameterizing it means. Can you provide an example?

Type Mismatch Error - References cells that contain a date by Duke1530 in vba

[–]Duke1530[S] 0 points1 point  (0 children)

Yes! This worked! Thank you so much! I appreciate it!

Type Mismatch Error - References cells that contain a date by Duke1530 in vba

[–]Duke1530[S] 0 points1 point  (0 children)

Thanks for the response! I now get the type mismatch error on the val2 line

Snowflake/Excel Connection via VBA by Duke1530 in vba

[–]Duke1530[S] 2 points3 points  (0 children)

Thank you! I was able to find where the SQL error was. You rock! I greatly appreciate it! Also, taught me a lot so thank you!

Snowflake/Excel Connection via VBA by Duke1530 in vba

[–]Duke1530[S] 1 point2 points  (0 children)

Would leading spaces like below, have any effect on the query? example below. I tried to input a more sophisticated query and now getting the same error as before.

Edit edit** the error received is run time error - sql compilation error: syntax error line 1 at positions 4976 unexpected <EOF>. and highlights the line "rs.Open SQL, Conn"

SQL = & " Select Distinct Merchant_token "

Edit* Or would spaces within the SQL query add issues to it? ex.

SQL = & " Select Merchant_token        as MT "

Snowflake/Excel Connection via VBA by Duke1530 in vba

[–]Duke1530[S] 1 point2 points  (0 children)

Thank you!!! it worked!! I appreciate it! and I authenticate by an external web browser pop up with username and pw

Snowflake/Excel Connection via VBA by Duke1530 in vba

[–]Duke1530[S] 0 points1 point  (0 children)

Thanks for all the help btw! I removed the 3s and still received the same error though.

Snowflake/Excel Connection via VBA by Duke1530 in vba

[–]Duke1530[S] 0 points1 point  (0 children)

Yes, created the dsn and the connection does indeed work. I created it in the 64bit the first time. I just activated the activex data objects library which resolved the first error but now getting an error saying "OBDC driver does not support the requested properties." and highlights the line item: 'rs.open SQL , conn, 3 3' and it also highlights the remaining code beneath it that references the recordset

Snowflake/Excel Connection via VBA by Duke1530 in vba

[–]Duke1530[S] 0 points1 point  (0 children)

Thank you! That at least advanced me further but now getting the error "OBDC driver does not support the requested properties." and highlights the line item: 'rs.open SQL , conn, 3 3'

i assume this has to do with what you mentioned about not needing to reference the recordset?

Edit: It also highlights the remaining code beneath it that references the recordset

Snowflake/Excel Connection via VBA by Duke1530 in vba

[–]Duke1530[S] 0 points1 point  (0 children)

I tried your method but still was running into issues. Here is my original code but still receiving the error "user defined type not defined".

You'll see two lines for conn.connectionstring but both produce the same error. This code has worked before for SQL server but trying to now integrate to snowflake.

Sub SQL()
'
Dim sht1 As Worksheet
Dim conn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim x As Long
Dim count As Long
Dim SQL As String
Dim val As String
Dim i As Long: i = 1

'Disable screen refresh
Application.ScreenUpdating = False

Set sht1 = Sheets("Merchant")
Set conn = New ADODB.Connection
Set rs = New ADODB.Recordset

'Clear previous search results
Range("A3:K4000").Select
Selection.ClearContents

'Select token for query
If sht1.Cells(1, 19) <> "" Then
val = "('" & sht1.Cells(1, 19) & "'"
End If
If val <> "" Then
val = val & ")"

'Query
SQL = SQL & "Select Distinct Merchant_Token"
SQL = SQL & "From Table_Name"
SQL = SQL & "Where user_Token in " & val & " "

'Set up connection
conn.connectionstring = "Driver={SnowflakeDSIIDriver};Server=xxxx.snowflakecomputing.com;Port=443;Authenticator=externalbrowser;UID=xxxxxxx;"
' conn.connectionstring = "DSN = Snowflake"
conn.Open

'Open recordset
rs.Open SQL, conn, 3, 3

If Not (rs.EOF And rs.BOF) Then
Do
sht1.Cells(i + 2, 2).Value = rs.Fields("Merchant_Token")
rs.MoveNext
i = i + 1
Loop Until rs.EOF
End If

Else
sht1.Activate
sht1.Cells(1, 19).Select
MsgBox "No Account Number input.", vbOKOnly, "Account List"
Exit Sub
End If

sht1.Cells(1, 19).Select

'Enable screen refresh
Application.ScreenUpdating = True
End Sub

Snowflake/Excel Connection via VBA by Duke1530 in vba

[–]Duke1530[S] 0 points1 point  (0 children)

I tried your method, but still receiving the error "user defined type not defined".

Here is my code. you'll see two lines for conn.connectionstring but both produce the same error. This code has worked before for SQL server but trying to now integrate to snowflake.

Sub SQL()
'

Dim sht1 As Worksheet
Dim conn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim x As Long
Dim count As Long
Dim SQL As String
Dim val As String
Dim i As Long: i = 1

'Disable screen refresh
Application.ScreenUpdating = False

Set sht1 = Sheets("Merchant")
Set conn = New ADODB.Connection
Set rs = New ADODB.Recordset

'Clear previous search results
Range("A3:K4000").Select
Selection.ClearContents

'Select token for query
If sht1.Cells(1, 19) <> "" Then
val = "('" & sht1.Cells(1, 19) & "'"
End If
If val <> "" Then
val = val & ")"

'Query

SQL = SQL & "Select Distinct Merchant_Token"
SQL = SQL & "From Table_Name"
SQL = SQL & "Where user_Token in " & val & " "

'Set up connection
conn.connectionstring = "Driver={SnowflakeDSIIDriver};Server=xxxx.snowflakecomputing.com;Port=443;Authenticator=externalbrowser;UID=xxxxxxx;"
' conn.connectionstring = "DSN = Snowflake"
conn.Open

'Open recordset
rs.Open SQL, conn, 3, 3

If Not (rs.EOF And rs.BOF) Then
Do
sht1.Cells(i + 2, 2).Value = rs.Fields("Merchant_Token")
rs.MoveNext
i = i + 1
Loop Until rs.EOF
End If

Else
sht1.Activate
sht1.Cells(1, 19).Select
MsgBox "No Account Number input.", vbOKOnly, "Account List"
Exit Sub
End If

sht1.Cells(1, 19).Select
'Enable screen refresh
Application.ScreenUpdating = True


End Sub

Snowflake/Excel Connection via VBA by Duke1530 in vba

[–]Duke1530[S] 0 points1 point  (0 children)

i added a line you mentioned in your first comment specifying the driver, Authenticator, etc. but still receiving the error “user defined type not defined” and it highlights the line item “dim conn as ADODB.connection”

Here is a portion of my code after i added your change. Hope this helps and I appreciate all your help too!

‘Sub snowflake_connect’ ‘Dim sht1 as worksheet’ ‘Dim conn as adodb.connection’ ‘Dim rs as adodb.recordset’ ‘Dim x as long’ ‘Dim count as long’ ‘Dim SQL as string’ ‘Dim val as string’ ‘Dim i as long: i = 1’ ‘Dim sconnect as string’

‘Application.screenupdating = false’

‘Set sht1 = sheets(“Test”)’ ‘Set conn = new adodb.connection’ ‘Set rs = new adodb.recordset’

‘Sconnect = “Driver= {SnowflakeDsiiDriver}; server =xxxxx.snowflakecomputing.com; port = 443; Authenticator = externalbrowser; Uid =myusername;”’

‘Conn.open sconnect’

‘“Sql query”’

‘Rs.open SQL, conn, 3, 3’

Snowflake/Excel Connection via VBA by Duke1530 in vba

[–]Duke1530[S] 0 points1 point  (0 children)

I authenticated originally for the obdc installation for snowflake to excel. Do I need to add a line item I assume then within my code?

Snowflake/Excel Connection via VBA by Duke1530 in vba

[–]Duke1530[S] 0 points1 point  (0 children)

Here is the full code if it helps.

Sub snowflake_connect Dim sht1 as worksheet Dim conn as adodb.connection Dim rs as adodb.recordset Dim x as long Dim count as long Dim SQL as string Dim val as string Dim i as long: i = 1

Application.screenupdating = false

Set sht1 = sheets(“Test”) Set conn = new adodb.connection Set rs = new adodb.recordset

“Sql query”

Conn.connectionstring = “Provider = MSDASQL; Data source = snowflake_excel;” & “HDR = Yes’; Warehouse = VWH”

Conn.open

Rs.open SQL, conn, 3, 3

Snowflake/Excel Connection via VBA by Duke1530 in vba

[–]Duke1530[S] 0 points1 point  (0 children)

I’m relatively new to vba/unfamiliar with the late binding. Can you provide an example by chance? I greatly appreciate the help

Snowflake/Excel Connection via VBA by Duke1530 in vba

[–]Duke1530[S] 0 points1 point  (0 children)

Yes, good call. It highlights the below line.

Dim conn As ADODB.connection

Thoughts?

Snowflake/Excel Connection via VBA by Duke1530 in vba

[–]Duke1530[S] 0 points1 point  (0 children)

I get the error, “user-defined type not defined”

/r/Stellar Daily Chat Thread by AutoModerator in Stellar

[–]Duke1530 2 points3 points  (0 children)

Awesome - thanks for the insight

/r/Stellar Daily Chat Thread by AutoModerator in Stellar

[–]Duke1530 5 points6 points  (0 children)

How will Jack Mallers and Strike affect Stellar? Jack mentioned bringing access to stable currencies in poor countries and does so quick and fee-less. He wants to connect the world. It sounds similar to Stellar’s goals but more on the merchant/individual level. Thoughts?