I have been trying to solve this issue for a while now and could really use some help!
Basically, I am trying to convert a SQL code into VBA but I'm having some issues with the piece below:
Expand|Select|Wrap|Line Numbers
- FROM HISTORY.dbo.tbl_Data
- Where
- Week_Ending = 'WE080611'
- AND Facility IN ('Hartford, CT')
- AND (Ledgend LIKE 'DEL')
- AND [Cust_#] IN ('12345')
- ) i
- GROUP BY DayofWeek
- ) j
In my excel file, I have a few drop down boxes and list boxes which I use to update the fields (except for the Ledgend part). I've already put together the majority of the code I'm just stuck on this one piece. Any help would be appreciated! Here's what I have right now..
Expand|Select|Wrap|Line Numbers
- "FROM HISTORY.dbo.tbl_Data" & _
- "WHERE [Facility] = '" & Facility & "' and [Week_Ending] = '" & WeekEnd & "' and (Ledgend LIKE 'DEL') AND [Route #] IN " & _
- "( SELECT DISTINCT [Route #] FROM HISTORY.dbo.tbl_Data WHERE " & _
- WhereStr & " AND (Ledgend LIKE 'DEL') " & _
- ") k" & _
- "GROUP BY DayofWeek" & _