Thank you both for the feedback and points to improve my query building. I will still tinker with this and apply it because i need to get it beat. However, with the project at hand i have a short deadline and i need to get the data moving so for now it is best to move over to access and get it...
Skip, I would love to stay in Excel with my queries however I feel I have maxed on my knowledge base here. Since i was having issues with this date problem I thought i would jump to another query and come back to it as the knowledge on this site helped out with ideas.
So I moved to this query...
Andrzejek, That was a typing error when i was cutting the date criteria in and out. The >0 should have been with the (dbo.pickwkahdr.num_pic) > 0 And (dbo.pickwkahdr.pic_zone) > 0 GROUP BY [pic_zone].
My apologies for that
Hey Guys, I think I am going to call the dogs off on this one. I moved on to some other queries and they are getting to complicated for me to convert to run from Excel. I think I am going to resort back to Access to crunch the data and then have Excel link to the Output table in Access and go...
Strongm, Still no data. Here is the immediate window display for the resulting SQL.
SELECT [pic_zone], Sum([num_pic]-[pic_comp]) FROM dbo.pickwkahdr INNER JOIN dbo.e202_pdc_pln ON dbo.pickwkahdr.wave_num = dbo.e202_pdc_pln.wav_nbr WHERE (dbo.pickwkahdr.num_pic) And ((dbo.e202_pdc_pln.upd_dm)...
Skip, Tried both and still no data return.
Strongm, The data is living in Sybase. I use Access to verify string and test/compare results. Yes I am using the same ODBC connection for both access and Excel. As mentioned if the date criteria is removed in Excel I get data returned. There is valid...
SOrry Skip, i realize that date/time is not less. I pulled that from the source table of where i am trying to filter back results.
In Access it returns what i am looking for and data is correct. In Excel it pulls back data so long as the date/time is not in the string.
To add a layer of interest to this. When i put the query in Access it runs. Here is the SQL from Access 2016 as is Excel 2016. I did have to remove the "'PZ' & " from the string as that was giving me fits in excel.
Running this query in Access with the date field having <#5/22/2017 6:00:00 AM#...
Skip, there was no change to value of C3 however i typed it incorrectly at the top when i was sharing this post. SQL was not changed. Yes the field upd_dm is a Date/Time field. Although it may not matter to much but here is value of a record straight out of the table - 5/22/2017 6:38:50 PM
Andrzejek - yes the field is a date/time field. As mentioned i had it working at one point. Also, without the date criteria I pull records.
Skip, Ran your query in PowerQuery and received error - DataSource.Error: ODBC: ERROR [42000] [Sybase][ODBC Driver][Adaptive Server Enterprise]Incorrect...
I have hit a wall here and trying to figure this out. At one point I did have it working and lost the changes due to system malfunction. Anywho, I thought i could recreate it and I can't seem to be able to do this. I have tested the base SQL string in PowerQuery and it works until I add the date...
that got it Skip, thank you! While on here you happen to know command to clear records of the table? I had the table set to 250 records and found that the code was putting it at the bottom of the table and then adding new rows after each run. So I resized the table to D1 to E2 and now it starts...
it does the same thing and over writes the last entry of the table instead of the first entry.
Here is the code piece that is connecting and writing to the table. Data is good and working like it should, just appending to table is my issue at this point.
Function ImportSQLtoRange(ByVal...
My apologies, i may have explained it poorly. Looking to start with a blank table. So run a "clear contents" command to clean out all records in the table. Then run multiple queries to repopulate the table.
Table size to start = 50 records (from last run when it works right)
run code to clear...
Thank you Skip however that is not working. Now it inserts at the end of the table? The table range is setup from D1 to E250. It is putting in last row of table with no other data in the table.
OK, i have Googled high and hard for a couple days to figure this out and just have to post because I find something close but not complete.
Here setting up the sql string. constring is a public varibable.
Sub ReplenQueue()
Dim strSql As String
Dim target As Range
Set target =...
Thank you Andy. "Last couple days" were spent trying to get it going while waiting on a response to this post! I learned a lot but still have way more to go! Thanks for the suggestions to clean things up, makes sense especially on the sql strings. I did have the debug.print commented out when I...
Hey Andy,
Sitting here tinkering I was able to get it figured out! So far everything appears to be spot on. I can't thank you enough for the support. I have spent the last couple days with help from another trying to get past the 3 day scenario string.
For anyone else, here is my complete code...
Thank you Andy! I have been playing with other tactics that were close but no go for sequence beyond 3 sequential days. I was excited to see your reply so thank you for taking a crack at it. I copied it over but i am getting error 438, Object doesn't support this property or method. Its bombing...
So I have researched this forum and the innerwebs trying to find some similar solution that I could outfit to work for my needs. Since I am posting here I have not succeeded in finding the solution so I appreciate your time to help me out.
Here is what I am looking to do via VBA and future one...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.