I created a sales application in MS Access 2007. The sales order form has the basics in the header (order number, date, order discount, sales tax). The order lines are entered in a subform. Today we are having a high volume of sales due to a sale and I noticed something that has not happened before...for the past few orders the sales tax on the order header stayed at zero!
I store the sales tax percentages in a variables table. In the VBA code for the header form AND for the subform both, I have the attached code. Those public variables are then used like this:
1) From the header form I update the sales tax field whenever someone changes the order discount on order header level.
2) I update the order header sales tax from the sales order line form with each change of price, quantity or discount on an order line.
The sales app is about 1.6MB in size (accdb file)...I noticed that it was 3.5 MB in size when this problem occured. Could this be a memory leak problem? I try to clear large variables at the end of each routine/function, such as SQL statements, record sets etc. Should I also set all simple variables (Currency, String, Long etc) to null? Is there a good way to trace memory usage during the running of an Access app to see what garbage it leaves behind?
Option Compare Database
Public gvarCityTaxPercentage As Single
Public gvarCountyTaxPercentage As Single
Public gvarStateTaxPercentage As Single
Private Sub Form_Load()
gvarCityTaxPercentage = DLookup("[CityTaxPercentage]", "tblVariables")
gvarCountyTaxPercentage = DLookup("[CountyTaxPercentage]", "tblVariables")
gvarStateTaxPercentage = DLookup("[StateTaxPercentage]", "tblVariables")