I have a table that has invoices and payments. The invoice line items have the invoice date and invoice number in the record filled in, the payment record has the payment date and payment amount filled in. They have the same invoice number and customer id. How do I set the invoice date in the payment record (which is blank) set to the date of the invoice record. I am doing an eligible for commision based on the invoice date, but the payments have a blank invoice date field. This is how I code it when updating separate tables, but I am having a brain block when doing it in the same table.
strSQL = "UPDATE tbl_ats_CommissionWork " & _
"INNER JOIN tbl_ats_Comm_Draw_Hist ON tbl_ats_CommissionWork.InvcNum = tbl_ats_Comm_Draw_Hist.Inv_Num " & _
"AND tbl_ats_CommissionWork.CustId = tbl_ats_Comm_Draw_Hist.Cust_ID " & _
"SET tbl_ats_CommissionWork.InvcDate = tbl_ats_comm_draw_hist.inv_date " & _
"WHERE tbl_ats_CommissionWork.InvcDate Is Null "
Thanks for any help. I hope I explained it well.
My table that I want to update the invdate is "tbl_ats_comm_draw_hist
strSQL = "UPDATE tbl_ats_CommissionWork " & _
"INNER JOIN tbl_ats_Comm_Draw_Hist ON tbl_ats_CommissionWork.InvcNum = tbl_ats_Comm_Draw_Hist.Inv_Num " & _
"AND tbl_ats_CommissionWork.CustId = tbl_ats_Comm_Draw_Hist.Cust_ID " & _
"SET tbl_ats_CommissionWork.InvcDate = tbl_ats_comm_draw_hist.inv_date " & _
"WHERE tbl_ats_CommissionWork.InvcDate Is Null "
Thanks for any help. I hope I explained it well.
My table that I want to update the invdate is "tbl_ats_comm_draw_hist