ADO SQL and Recordset HELP!!

MsAmanda

New Member
Joined
Dec 15, 2015
Messages
3
Hello All, I am having the most wretched time trying to figure this out. I have a worksheet with merged cells (I cant change the input format, I know, I know merged cells are evil and very true for me right now). But anyway in order to get the data I need I have to run 2 queries which works fine, but I need to either some how redo my queries to get or merge the end record sets so that either way I end up getting the Comments appended to the original data retrieved in the first query so I can then make a table in excel that makes sense and I can work with. Please help someone, Ive spent almost 2 days on this and making me crazy.






Code:
Sub TestSQL4()
    Dim strSQL
    Dim fname
    Dim tblheader
    Dim rs As New ADODB.Recordset
    
    fname = "Poam.xls"
    tblheaders = "Yes"
    
    'strSQL01 = "SELECT [CAT], [POC], [IA Control and Impact Code], [Resources Required], [Estimated Completion Date], [Source Identifying Weakness], [Status], [Comments] FROM [PackagePOAM$A13:U160] where [CAT] = 'III'"
    
    strSQL02 = "SELECT [Comments] FROM [PackagePOAM$A13:U160] where [Comments] not Like '%the IAC is NA%'"
   
    RunQuery strSQL, fname, tblheaders, rs
            
End Sub
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Im getting closer again I need to either find a SQL way to do this or via VBA recordset results the below ADO query/subquery is almost it

Code:
Select FirstSelect.Cat, FirstSelect.ID, SecondSelect.Comments From ((Select [CAT] As Cat, [ID] As ID From table1) As FirstSelect (Select [Comments] As Comments From table1 Where [Comment] is not Like '%NA%') As SecondSelect)
 
Upvote 0

Forum statistics

Threads
1,215,756
Messages
6,126,686
Members
449,329
Latest member
tommyarra

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top