Forum Discussion
Add inputbox value into a where clause in odbc.query
- Apr 23, 2023
Hi dlc04
Little add. to NikolinoDE
Assuming the value in B2 is like dd/mm/yyyy your selectedDate step returns a DateTime value (i.e. 01/01/2023 00:00:00). If SnowFlake expects a Date value (i.e. 01/01/2023) only you'll have to convert the DateTime value to a Date value before converting it to a Text value. Can be done as follow:
selectedDate = Text.From( DateTime.Date( Table.FirstValue(Excel.CurrentWorkbook(){[Name="mydate"]}[Content]) ) ),
Found a way to do it. I was using the refreshAll along with the AsyncQueriesDone
ThisWorkbook.RefreshAll
Application.CalculateUntilAsyncQueriesDone
which I'm guessing it was running the query while it was trying to update such query at the same time.
So I used
ThisWorkbook.Connections("Query - Query1").Refresh
And in the query properties I unchecked the option "Enable background refresh".
Hi dlc04
VBA isn't my cup to tea and the doc. of Application.CalculateUntilAsyncQueriesDone didn't help me understand what this method actually does. I was going to suggest you try disabling Background Refresh though...
Glad you found a suitable solution & Thanks for documenting it, hopefully this will help sooner or later
FYI an old case: Application.CalculateUntilAsyncQueriesDone Causes Excel to freeze and crash