473,382 Members | 1,658 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

How do I store Totals in Access using VBA code

I have created an Inventory Table with total fields for qty of all purchases for each stock item and one for the customer orders. I have created tables for the purchase order detail lines and customer order detail lines and have built test data to these tables and all looks good. Have tried queries but no joy there. All I want to do is hold the total qty of all purchases and sales by part number and then calculate stock level. Any ideas on how I can do this are welcome. Thomas
Sep 2 '15 #1
6 1610
jforbes
1,107 Expert 1GB
The best advice I can offer you is to purchase an Accounting package. There is a lot under the hood of an Accounting application that is easily over looked and that isn't fully realized until you get in and start messing around with it. Stock level is one aspect that can be a bit daunting, but there are at least a dozen different ways to cost an Item. You may only see the need for one, but sooner or later you or someone else will find a need to cost an item differently and if this isn't planned for in the beginning, you will end up rewriting a lot of your code and queries. And costing is just one of the many gotchas. Serial tracking and Lot tracking can be a barrel of fun.

But if you want to see what you can accomplish, I would recommend:
  • Create an InventoryItem Table to store Inventory Item Definitions. Things like Item Number, Costing type, Tracking Type, Unit of Measure, Active.
  • Create a WarehouseLocation Table with address information (or a lookup to an address record) Stocking type, like Stock or non-stock.
  • Create a ItemWarehouse table to link Items to Warehouses and Quantities on Hand.
  • Create an InventoryTransaction Table to store transactions like moving some of an Item from one warehouse to another. This is where things can get really messy because if you are doing any form of accounting of costs, activity in this table will directly relate to your Accounts Receivable and Accounts Payable, and they will need to match up.
If you are costing:
  • Create a Customer/Vendors Table to link to an address and set credit limits.
  • Create an Customer Orders Table to hold information about a customer order.
  • Create a Customer Orders Lines table to hold Items that a customer is ordering
  • Create a Purchase Order Table to buy Inventory
  • Create Purchase Orders Lines Table to include Items to be purchased
Even if you aren't costing, you may need to address how you are shipping and receiving your inventory. Which would mean more tables.

If you are still at this... Then create a routine that Queries the InventoryTransaction table and updates the ItemWarehouse table with the current OnHandQuantity for an Item. Doing this could be considered going against http://bytes.com/topic/access/insigh...ble-structures, but this would be one place where your database might not be considered fully normalized (depending who you are talking to) since the query to look through a decade of Inventory Transactions can take quite a while. Then as you add code to Ship or Receive Inventory (or internal moves of inventory from one warehouse to another), have it create an InventoryTransaction then call the routine that updates the OnHandQuantity so that when you query an ItemWarehouse, the quantity available will be accurate.

There is a lot to this, but that is the basics.
Sep 2 '15 #2
BikeToWork
124 100+
JForbes, are you an accountant by any chance. I was very impressed with your post. Could you do all this in Peachtree or other off the shelf accounting software?
Sep 2 '15 #3
jforbes
1,107 Expert 1GB
Glad you liked it. I'm not an accountant, but I spent quite a few years writing ERP Software, which caused me to spend a lot of time in code dealing with accounting and talking to accountants on how best to accomplish what was needed.

There are a lot of Accounting packages out there and it looks like Peachtree has Inventory Management which would allow you to Maintain Inventory. The one thing that I didn't care for is that it's not using a SQL Server Database, which I would consider a Requisite if you ever want to develop against the database or create your own reports outside of their system.

I could recommend a couple packages, but I don't think this is the best forum for that. So I'll just reiterate that having SQL as a Backend should be required.
Sep 3 '15 #4
Thank you jforbes for the reply to my question.
I have created all the tables you have suggested and more and populated the tables with data. The only outstanding point is I would like to store for each stock item totals of purchases, sales from which I can calculate the stock level.

I have been in IT for over 45 years prior to retiring in 2007.

Recently I came out of retirement to help the son of a friend get his failing business back on track.

At this point in time funds are limited otherwise I would have suggested buying good software.

I have only dabbled with Access DB in the past and with a 7 year gap from working I need to get back up to speed fast and do most of stock control myself a payroll and accounts package to handle the rest.

I hope that explain the position I am in.

Regards

Thomas
Sep 3 '15 #5
jforbes
1,107 Expert 1GB
I started replying with some recommendations on what to do next and two things happened:
  • I got a little bummed out when I realized how much I was going to need to type in.
  • Then it changed to excitement when I thought about making a sample to show what I was thinking instead of regurgitating a bunch of recommendations.

So I threw this together today. I had a good time with it: http://bytes.com/attachment.php?atta...1&d=1441409648

It's just a starting point and Costing and Tracking are not addressed in the sample, but it does include a transaction table and a little query to sum the transactions to find the OnHandQuantity.

Hope it helps and let me know if I messed anything up or you need an explanation of something.
Attached Files
File Type: zip InventoryExample.zip (69.7 KB, 192 views)
Sep 4 '15 #6
This is brilliant ^
May 2 '17 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Sergio del Amo | last post by:
Hi, I implemented a Web-Site based in remote scripting with hidden frames. I am using Javascript to provide dynamic functionality. In the machine's local server works perfectly but when i uploaded...
2
by: MissiMaths | last post by:
I have already posted a similar question to this but the answers didn't work so I have decided to post again and hopefully I can be a little more specific about what I need. I am using access and...
0
by: Jack | last post by:
Windows 2K Pro Access/Excel 2003 Hi there, I have a large number of password protected Excel Workbooks. The files are protected by code that runs when the workbook opens. The code asks the...
1
hariharanmca
by: hariharanmca | last post by:
How to Shift or Copy Data from Sqlserver to MS Access using Stored procedure I am passing the clint MS Access file path in that i want to insert or update data in that MS Access file using...
3
by: ofilha | last post by:
I need to format a column in excel but would like to do it from Access using VB. I have hacked around and found a few ways to get to the workbook but have a problem getting to the sheet i want. But,...
18
by: hotflash | last post by:
Hi Mark et All, I understand that you created a very professional document and a similar issue forum out there regarding to Inserting the checkbox value into MS Access using ASP however; I am so...
2
by: shivapadma | last post by:
is it possible to access MS ACCESS using c++? if yes,then how can i access? is it similar to java language? i.e, 1.loading 2.connecting 3.using
0
by: JFKJr | last post by:
I have an excel file, which has columns C and D grouped together, I am trying to delete blank columns and rows from the excel file, ungroup the columns and import the file to MS Access using Access...
6
by: =?Utf-8?B?QmVu?= | last post by:
Hi all, Is there any good resource online that you can share with me about programming Access using C#. I am trying to get my feet wet with C# and vs2008. I tried looking at kb317114, it...
0
by: bheemreddy | last post by:
i need know the AcSpreadsheettype for doing this. also, i need to import only one sheet from the workbook. need help.
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.