I have a main table.. the main table has fields for TotalGross / TotalCube / TotalNet etc..
Another table linked ( 1-many) hold the actual cargo.. (crates etc..) A listbox on the main shipment page holds the values in columns (seal number / Gross / Net / Tare / Cube.
This all works fine.. The numbers are setup in table as double & on the forms as fixed w/ 2 as decimal place.. this seems to work fine as well.. list displays correct - it calculates the cubic feet etc fine.
On the main page i need to get the totals in some seperate text boxes... Here is the code i had written but im getting a DATA MISMATCH and i cant seem to figure it out.
Option Compare Database
Option Explicit
Public Function UpdateMilBoxTotals()
Dim TotalGross As Double
Dim TotalTare As Double
Dim totalPc As Double
Dim TotalNet As Double
Dim totalcube As Double
Dim Listcount As Integer
Dim I As Integer
On Error GoTo ErrorHandler
If Form_AeclMilitaryMainScreen.MilBoxList.Listcount = 0 Then
Exit Function
End If
TotalGross = 0
Listcount = Form_AeclMilitaryMainScreen.MilBoxList.Listcount
I = 1
Do
TotalGross = TotalGross + Form_AeclMilitaryMainScreen.MilBoxList.Column(1, I)
I = I + 1
Loop Until I = Listcount
Form_AeclMilitaryMainScreen.ManualGross = TotalGross
ExitRoutine:
Exit Function
ErrorHandler:
MsgBox Err.Description
Resume ExitRoutine
End Function
Another table linked ( 1-many) hold the actual cargo.. (crates etc..) A listbox on the main shipment page holds the values in columns (seal number / Gross / Net / Tare / Cube.
This all works fine.. The numbers are setup in table as double & on the forms as fixed w/ 2 as decimal place.. this seems to work fine as well.. list displays correct - it calculates the cubic feet etc fine.
On the main page i need to get the totals in some seperate text boxes... Here is the code i had written but im getting a DATA MISMATCH and i cant seem to figure it out.
Option Compare Database
Option Explicit
Public Function UpdateMilBoxTotals()
Dim TotalGross As Double
Dim TotalTare As Double
Dim totalPc As Double
Dim TotalNet As Double
Dim totalcube As Double
Dim Listcount As Integer
Dim I As Integer
On Error GoTo ErrorHandler
If Form_AeclMilitaryMainScreen.MilBoxList.Listcount = 0 Then
Exit Function
End If
TotalGross = 0
Listcount = Form_AeclMilitaryMainScreen.MilBoxList.Listcount
I = 1
Do
TotalGross = TotalGross + Form_AeclMilitaryMainScreen.MilBoxList.Column(1, I)
I = I + 1
Loop Until I = Listcount
Form_AeclMilitaryMainScreen.ManualGross = TotalGross
ExitRoutine:
Exit Function
ErrorHandler:
MsgBox Err.Description
Resume ExitRoutine
End Function