Hi Seenu,
I'll prefer to remove from the result set only but now sure how to do that? I please send me the sample for the same.
Please fine below code used for result set
Code:
strSelectSQL = "SELECT " & _
"[Banker], " & _
"[Income YTD], [AnnRevenue], " & _
"[VRevenueTargetCY], [RevenuePriorFY], " & _
"[VAnn vs Budget], [VAnnu vs Prior FY Revenue], " & _
"[Income YTD], [Ann ARevenue], " & _
"[ARevenueTargetCY], [ARevenuePriorFY], " & _
...
...
...
...
"[AnnuVRevenue] / [TotalAnnuRevenue] AS [Annu Actual V Ratio] " & _
"FROM tbl_WConsol " & _
"INNER JOIN tbl_Bankers ON tbl_WConsol.[Banker] = tbl_Bankers.[BankerNm] " & _
"WHERE [YearMonthWeek] = '" & txtReportingMonth & CStr(gsReportingWeekNo) & "'" & _
"AND Team = '" & sTeamRegionName & "'"
Set rsTmp = gsPnPDatabase.OpenRecordset(strSelectSQL)
recount = rsTmp.RecordCount
rsTmp.MoveFirst
RowEnd = RowStart + recount
For count = 1 To recount
ColumnStart = 1
objXLSheet.Cells(RowStart, ColumnStart) = rsTmp![Banker]
ColumnStart = ColumnStart + 1
objXLSheet.Cells(RowStart, ColumnStart) = rsTmp![RevenueYTD]
ColumnStart = ColumnStart + 1
objXLSheet.Cells(RowStart, ColumnStart) = rsTmp![AnnuRevenue]
ColumnStart = ColumnStart + 1
objXLSheet.Cells(RowStart, ColumnStart) = rsTmp![RevenueTCY]
ColumnStart = ColumnStart + 1
objXLSheet.Cells(RowStart, ColumnStart) = rsTmp![RevenuePFY]
ColumnStart = ColumnStart + 1
objXLSheet.Cells(RowStart, ColumnStart) = rsTmp![AnnuVsBud]
ColumnStart = ColumnStart + 1
objXLSheet.Cells(RowStart, ColumnStart) = rsTmp![AnnuVsPFYRev]
ColumnStart = ColumnStart + 1
..............
..............
..............
..............
..............
ColumnStart = ColumnStart + 1
objXLSheet.Cells(RowStart, ColumnStart) = rsTmp![AnnuActRatio]
If rsTmp.EOF Then Exit For
RowStart = RowStart + 1
rsTmp.MoveNext
Next count
rsTmp.Close
Set rsTmp = Nothing