Hi
I'm slowly getting to grips with Access, and use Access 2003 at work, so have installed same version at home.
This is probably a daft question, so I apologise in advance. i've searched the net, and gone through all 8 of my Access books, and I can't find the answer, but this could be because I don't know the right name for the function I need.
I have my main table, where sales are logged, each entry is logged, who bought what, per line, but someone could buy more than item on a day.
ie Main Table
Purchase Date BuyerName BuyerID ItemID ItemDescription Price InvoiceNo
31/12/2012 J Bloggs 4443 23 Desk 30.00
31/12/2012 J Bloggs 4443 26 4 chairs 30.00
31/12/2012 J Bloggs 4443 28 Bookcase 30.00
InvoiceDetails
Date
InvoiceAutoNo Date BuyerID BuyerName Totalitems TotalPaid
1001 31.12.2012 4443 JBloggs 3 90.00
1002 31.12.2012 93 CJones 4 45.00
I ran a report, which brought one line per buyer and by purchase date, and total number of items bought on that day, along with total value which I fed into a new table I have called tblInvoiceDetails, along with Invoice Number which is an auto number.
How can I pull the invoice number, from table InvoiceDetails, back into my main Sales table, by Purchase Date and BuyerID.
So if for example, that buyer bought 4 items on 31.3.2012 the same invoice number is applied to all 3 lines in my main table?
I now want to bring the invoice number back into my main report, by CustomerId and AuctionDate
I'm hoping its pretty simple, I tried to follow the NorthWind example, with main table and details table, but I'm not sure on there, if the queries populate the tables, or the tables were already populated and queries are based on the tables.
I was trying to think about how I'd do it in excel, and see if I could do it in Access, but i got myself a bit confused
I wanted an IF statement, that if ItemLog.CustomerID = BuyerInvoice.CustomerID AND ItemLog.AuctionDate = BuyerInvoice.AuctionDate are the same, then pull in Invoice Number.
But I couldnt get it to work
Once I've done this for my Buyers, I can do exactly the same thing for Sellers.
Thanks so so much for your help in advance
Clair