The expiry date may or may not be different each time you receive a new batch of the same product.
When you sell product, the quantity sold should be minused from the batch of the product with the same expiry date
Main Topics
Browse All TopicsAm developing an application in Access 2003 for a pharmaceutical company. Now i have a combo list that shows the product name, quantity and expiry date.
How do i make the stockbalance get update as well as the expiry date.
Remember that when stock is received into the system, it is received with the expiry date of the product. So a particular product XYZ can be received twice at different quantities with different expiry dates.
so at the point of sale, product XYZ will appear twice each with its quantity and expiry date. so when a particular batch is sold, only that batch's quantity should be substracted from the stock.
How do i make this happen. Bearing in my that the product XYZ has one Unique product ID in the products table.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Go through above example (Simple to understand), i have considered conditions which can occur.
Hope it will clear all doubts.
Take an example of your situation:
1. In beggining, nothing will be there in the databse.
Database Entrires
unique_id product_name quantity expiry_date
2. Recieve an order with product_name = 'A', quantity = 200, expiry_date = 20 dec 2010
Database Entrires
unique_id product_name quantity expiry_date
1 A 200 20 dec 2010
3. Again Recieve an order with product_name = 'A', quantity = 100, expiry_date = 20 dec 2010
Now check in database, if record is present with same product_name and expiry_date.
If yes(as in this case), then add quantity to the existing item (update query).
Database Entrires (check quantity)
unique_id product_name quantity expiry_date
1 A 300 20 dec 2010
4. Again Recieve an order with product_name = 'A', quantity = 500, expiry_date = 25 dec 2010
Now again check in database, if record is present with same product_name and expiry_date.
If no(as in this case), then add new entry in db (insert query).
Database Entrires (check expiry_date)
unique_id product_name quantity expiry_date
1 A 300 20 dec 2010
2 A 500 25 dec 2010
5. Now you sold the product_name = 'A' with expiry_date = 25 dec 2010 and quantity = 50
Subtarct the quantity in db for same product and expiry_date.
Database Entrires (check quantity)
unique_id product_name quantity expiry_date
1 A 300 20 dec 2010
2 A 450 25 dec 2010
thank for your contribution. My skill is quite shallow can you explain further on how to design the query or write the code to do that? I have attached the database here. So you can look at it on the form called Orders or by clicking the Sell to customers button on the swicthboard. The product drop down combo list there.
Thanks a lot!!!!
Its simple to write queries for UPDATE and INSERT.
In case of UPDATE, record will always be there in database for particular expiry_date and product_name, Just get the quantity and unique_id of that record.
Get new_quantity :
new_quantity = add or subtract to quantity obtained from database depending on your operation.
Then UPDATE <table_name> Set quantity = new_quantity where unique_id = <id>.
And if record is not present in database, then you will INSERT like
INSERT into <table> ....
Business Accounts
Answer for Membership
by: amitkathpal123Posted on 2009-11-03 at 03:07:39ID: 25727709
Will the expiry date be always different, each time stock is received and also when you sell product you will be having expiry date with you.
If above statements are true. Then you can get the product_id from database for given product and expiry date. Once you have the product_id with you, you can update the record as you want.