If (Request("savepayment") = "บันทึก" ) then
sql = ""
sql = "Select * From DLR_LCN_DTLS,DLR_SUP_SRC_INFO,VSC_VEH_MST,DSP_SRS_MST,DLR_SUP_PMY_CTRL "
sql = sql & " Where DLR_LCN_DTLS.LD_VIN_NO = DLR_SUP_SRC_INFO.SSI_VIN_NO "
sql = sql & " and DLR_LCN_DTLS.LD_SUP_CD = DLR_SUP_SRC_INFO.SSI_SUP_CD "
sql = sql & " and DLR_LCN_DTLS.LD_VIN_NO = VSC_VEH_MST.VM_VIN_NO "
sql = sql & " and DSP_SRS_MST.SMT_SRS_CD = VSC_VEH_MST.VM_SRS_CD "
sql = sql & " and DLR_LCN_DTLS.LD_VIN_NO = DLR_SUP_PMY_CTRL.SPC_VIN_NO "
sql = sql & " and DLR_LCN_DTLS.LD_SUP_CD = DLR_SUP_PMY_CTRL.SPC_SUP_CD "
sql = sql & " Order by VM_SRS_CD,VM_MOD_CD,VM_MOD_SFX,VM_CLR_CD"
set rs = conn.execute(sql)
do while not rs.eof
chkbxpayment = "paymentcode"&rs("LD_VIN_NO")
If (Request(chkbxpayment) = rs("LD_VIN_NO")) then
txtpaydtupdate = "txtpayment_dt_date"&rs("LD_VIN_NO")
txtpaydtupmonth = "txtpayment_dt_month"&rs("LD_VIN_NO")
ttxtpaydtupyear = "txtpayment_dt_year"&rs("LD_VIN_NO")
y = split(txtpaydtupyear,"-")
If (Request(txtpaydtupyear) = "") OR (Request(txtpaydtupmonth) = "") OR (Request(txtpaydtupdate) = "") then
txtpaydtupDMY = ""