I have 2 tables (AccountActivity) & (Reqlog) in my database. I want to create a code to run through the (AccountActivity) table and based on the following conditions below add new tables to the (Reqlog) table.
The (AccountActivity) has the following fields:
Account
RequisitionNbr
Prefix
Trans Date
Voucher Nbr
Ref Type
These are the conditions.
If the RequisitionNbr field & Prefix field are Not Null, then search the (Reqlog) table for the same RequisitionNbr & Prefix. If missing from the (Reqlog) table, add that record from the (AccountActivity) table with the Account #, RequisitionNbr, Prefix & Trans Date in the associated fields of the (Reqlog) table. I also do not want to add multiple records for the same Prefix & RequisitionNbr as they frequently occur multiple times in the Account Activity table.
These are the fields for the (Reqlog) table.
AutoID
Account
Prefix
RequisitionNbr
Date
Cost
Can you please help me come up with a code that I could run that can accomplish these conditions.
Thanks