Much better now but there is blank record on the first record
xlWorkSheet = xlWorkBook.Worksheets("Biweekly")
With xlWorkSheet
'For Each Name on Table
var_int = 8
app_cmd.CommandText = "select distinct emp_id, emp_name from tc_print where week_id=" & week_id & " and emp_group='" & emp_group & "' order by emp_name;"
app_dr = app_cmd.ExecuteReader()
While app_dr.Read()
the_emp = app_dr(0)
.Cells(var_int, 1).Value = the_emp
.Cells(var_int, 2).Value = app_dr(1)
'For Each Record on each Emp
bi_cmd.CommandText = "select col_type,day_1,day_2,day_3,day_4,day_5,day_6,day_7,day_8,day_9,day_10,day_11,day_12,day_13,day_14,day_tt from tc_print where week_id=" & week_id & " and emp_group='" & emp_group & "' and emp_id=" & the_emp & " order by day_pos;"
bi_dr = bi_cmd.ExecuteReader()
While bi_dr.Read()
.Cells(the_int, 3).Value = bi_dr(0)
.Cells(the_int, 4).Value = bi_dr(1)
.Cells(the_int, 5).Value = bi_dr(2)
.Cells(the_int, 6).Value = bi_dr(3)
.Cells(the_int, 7).Value = bi_dr(4)
.Cells(the_int, 8).Value = bi_dr(5)
.Cells(the_int, 9).Value = bi_dr(6)
.Cells(the_int, 10).Value = bi_dr(7)
.Cells(the_int, 11).Value = bi_dr(8)
.Cells(the_int, 12).Value = bi_dr(9)
.Cells(the_int, 13).Value = bi_dr(10)
.Cells(the_int, 14).Value = bi_dr(11)
.Cells(the_int, 15).Value = bi_dr(12)
.Cells(the_int, 16).Value = bi_dr(13)
.Cells(the_int, 17).Value = bi_dr(14)
.Cells(the_int, 18).Value = bi_dr(15)
the_int = the_int + 1
End While
var_int = the_int
bi_dr.Close()
var_int = var_int + 2
the_int = var_int
End While
app_dr.Close()
End With
End With