Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need sample code to read, compare & update/write to Access tables!!!!!

Status
Not open for further replies.

rmoemoney

Technical User
Feb 12, 2003
2
US
If someone could provide me with a sample, I can figure out the rest. I need to read from one table find the first occurence in the second table and create a third table with results and update both table 1 & 2. See brief scenario below: Thanks!!!

I have 2 tables in Access. In 1 table I have invoice info for acct#1 (acct#,Inv#,product,sales year&month,qty). I receive a file from acct#1 when they distribute the product we sold to them to other accts. When they do this, I need to reduce acct#1 sales by creating a reversing invoice and creating an invoice for acct#2, acct#3, etc. See sample data below.

Acct#1 (File#1)
Acct# Prod Inv# Year Mth Qty
11111 xxxx 1234 2002 01 5
11111 xxxx 2345 2002 01 10
11111 xxxx 3456 2002 02 20

Acct#1 sends file with following tracings. (File#2)
Acct# Prod Year Mth Qty
22222 xxxx 2002 01 10
33333 xxxx 2002 02 5
44444 xxxx 2002 02 2

I would like to generate the following.
Acct# Prod Inv# Year Mth Qty
11111 xxxx 1234 2002 01 -5
11111 xxxx 2345 2002 01 -5
11111 xxxx 2345 2002 01 -5
11111 xxxx 3456 2002 02 -2
22222 xxxx 1234 2002 01 5
22222 xxxx 2345 2002 01 5
33333 xxxx 2345 2002 01 5
44444 xxxx 3456 2002 02 2

The month that acct#1 purchased and then reported will not always be the same, as my example shows. I want to back out of acct#1 in the month they purchased it and add to acct#? in the month that acct#1 shipped it to them.

How can I do this using Access?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top