Dim filter As String = "" For Each r As Row In Tables("pl_Table1").GetCheckedRows filter &= "'" & r("户号") & "'," Next
cmd.CommandText = "Insert into {xlh} (户号,姓名,身份证号,合作医疗证号,参合时间,缴费金额) select {hkxx}.户号,姓名,身份证号,医疗证号,'" & d & "','" & val & "' from {hkxx} INNER JOIN {ylz} ON {hkxx}.户号 = {ylz}.户号 where {hkxx}.户号 in (" & filter.TrimEnd(",") & ")"